Illegal access to constructor com.glide.ui.SysAttachmentInputStream(object)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 02:17 AM - edited 10-22-2024 04:20 AM
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?