Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

what is the package call replacement script object for "Packages.java.io.FileOutputStream(File)".

muralik596
Kilo Explorer

Hi,

 

Can any one suggest me the package call replacement script object for "Packages.java.io.FileOutputStream(File)".

 

I have used the above package to convert the .txt file to .zip file. During the execution, i got an error saying "java.lang.SecurityException: Illegal attempt to access class 'java.io.FileOutputStream' via script". I believe the cause for above is package replacement.

 

Note: Currently we are using Calgary release of service-now.

 

Please suggest me package replacement.

 

Thanks in advance,

Murali.

1 REPLY 1

tltoulson
Kilo Sage

Hi Murali,



Sadly, I believe that the Package Replacement calls only apply to Glide specific packages (and snc packages).   See Packages Call Replacement Script Objects - ServiceNow Wiki for details.



That said, you may be able to make use of GlideZipUtil, GlideFile, and/or GlideFileUtil.   Using these can take a bit of brute force though as most of the Packages are undocumented.   You can use a background script to investigate the API:



for (var i in GlideFileUtil) {


      gs.print(i);


}



In some packages, you need to use an instance of the class so you can also investigate the API using:



for (var i in new GlideFileUtil()) {


      gs.print(i);


}



Edit:   Another option is to use a MID Server where Package calls are still permitted.