Illegal access to constructor com.glide.ui.SysAttachmentInputStream(object)

Kurbo
Tera Contributor

Hello,

I'm trying to adjust RESTMessageV2 API which will POST desired attachment from SNOW to JIRA within predefined JSON body structure which should look like this:

 

"attach_to_jira": {
      "attachment_date": "YYYY-MM-DD",
      "encoded_string": "???",
      "content_type": "*/*",
      "file_name": "example.pdf",
      "u_number": "NUMB0000001"
}

 

Implementation should also support files larger then 5MB what means that base64 method is not sufficient.

I've already tried setRequestBodyFromAttachment but unfortunately I'm not able to achieve JSON format of body I mentioned above and I'm neither able to extract this attachment encoded string from this kind of request. (what would as well solve my problem) 

Anyway at this moment I'm stuck with combination of 
GlideSysAttachmentInputStream, writeTo & base64 methods which work as charm in background script:

 

var gsa = new GlideSysAttachmentInputStream(pdfAttachmentSysid);
var baos = new Packages.java.io.ByteArrayOutputStream();
gsa.writeTo(baos, 0, 0);
baos.close();
var base64 = GlideStringUtil.base64Encode(baos);

 

but in real world scenario and combination with business rule and script include they just refuse to work throwing error:
java.lang.SecurityException: Illegal access to constructor com.glide.ui.SysAttachmentInputStream(object)

Do you have any idea how can I adjust already mentioned methods to achieve my goal or is there anything else what can I try please?
 

5 REPLIES 5

Kurbo
Tera Contributor

Hi Tobi, 
unfortunately not. I'm still stuck with this issue and I will update this thread if this fact changes.
In case you mange to find any solution feel free to use this article and share your findings please!