Question
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689960000/bfd69d7d-2f0a-4955-b649-0fb4184359a4.jpg?itok=O_uKM2fK)
Rulesware
CA
Last activity: 3 Oct 2019 15:12 EDT
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);
}
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.
And here is some debug information.
Any help will be greatly appreciated.