Question

39
Views
Close popover
Apriyanti Sitorus (ApriyantiS)
Pt. Asuransi Sinar Mas

Pt. Asuransi Sinar Mas
ID
ApriyantiS Member since 2017 2 posts
Pt. Asuransi Sinar Mas
Posted: January 21, 2021
Last activity: January 22, 2021

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

error

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

***Edited by Moderator Marissa to update Platform Capability tags****
Pega Platform Data Integration Java and Activities Insurance