Question

1
Replies
153
Views
NadeemM8116 Member since 2018 5 posts
Rulesware
Posted: 1 year ago
Last activity: 1 year ago
Closed

File downloaded with 0 bytes

I am working on a PoC and need to show contents of a TIFF file downloaded from FileNet. I need help in figuring out why the downloaded file is empty.

I have a soap connector that retrieves TIFF content stream from FileNet P8. This content stream is stored in a Text property on clipboard (in pyWorkPage) along with file name and mime type. I pass these values to parameters and retrieve them in Java code.

Below is the Java code that I am using.

String cS = tools.getParamValue("contentStream");

String cID = tools.getParamValue("caseID");

String filePath = pega.getStaticContentUtils().getServiceExportRoot();

String fN = tools.getParamValue("fileName") + "." + tools.getParamValue("mimeType");

String explicitTmpDir = tools.getSystemSettings().getFSSetting("initialization/explicittempdir", "" , true, false);

String PathDir= explicitTmpDir +"/StaticContent/global/ServiceExport/";

try {

byte[] byteArray = cS.getBytes();

java.io.File FileName = new java.io.File(PathDir+fN); // create file

java.io.FileOutputStream fileOuputStream = new java.io.FileOutputStream(FileName); fileOuputStream.write(byteArray); // write data into file

fileOuputStream.close(); // close file

pega_rules_default.downloadFile(FileName, tools, true); // download file and delete afterwards

} catch(Exception e) {

oLog.error("TestStream exception in Java step: " + e);

}

The code doesn't throw any error or exception but opens an empty file. If I choose to save file on my local drive, it shows a 0 byte file.

Image removed.

And here is some debug information.

Image removed.

Any help will be greatly appreciated.

Data Integration Java and Activities
Moderation Team has archived post
Share this page LinkedIn