Question
Pt. Asuransi Sinar Mas
ID
Last activity: 22 Jan 2021 10:49 EST
Can't use java.io in Java Step
I want to download a file from server, so i refer to this link https://collaborate.pega.com/question/download-file-server-location-local-location-system
But, everytime i call java.io.File or java.io.FileInputStream, or another java.io.*, my activity turns error.
String filePath=tools.getParamValue("FilePath");
String fileName=tools.getParamValue("FileName");
try
{
java.io.File fileIn=new java.io.File(filePath);
java.io.FileInputStream streamIn=new java.io.FileInputStream(fileIn);
PRFile file=new PRFile(fileName);
PROutputStream prOut=new PROutputStream(file,true);
int a;
while((a=streamIn.read())!=-1)
{
prOut.write(a);
}
streamIn.close();
tools.sendFile(file,true,null,true);
}
catch(Exception e)
{
oLog.error("Error when retrieving the file:"+e);
}
this error show after i refresh the activity
i already call the java.io.* in my library, and when i saved, it works fine.
Do i have to import library java.io to my application? or Pega 8 doesn't support java.io.* anymore?
Thank you for helping