Close popover
Ranjithkumar Chinnaswamy (RanjithkumarC)

RanjithkumarC Member since 2013 19 posts
Posted: June 16, 2020
Last activity: June 16, 2020

how to File Read from Shared folder (not from Service Export dir) in Pega 8

Hi We have written Java code to read from a shared folder  as below . It works in pega 7.2 and not working in Pega 8.2 


We have PRFile  but it is working only with service export directory . Any other file path given for PRfile is throwing null pointer exception. 


In pega 8 the code fails at   if(thisFile.isFile()) even though files are present and works in pega 7.

workDir.list() is only picking the folders but not files inside of it. 


Any help is appreciated either to make PRFile work with external folders .


Tweak why the workDir.list() is not working in Pega 8 ..

We also tried  RA file but ajav step is not compiling. 




try { file = new"/home/");       System.out.println( "contents length : " + file.listFiles().length);


**************************************** workDir = new; int FileNo = 0; long lastModified = 0;

try {

if(workDir.isDirectory()) {    String[] filesInFolder = workDir.list();    for(FileNo = 0; FileNo < filesInFolder.length; FileNo++)    {          String FilePath = FolderPath +"/"+ filesInFolder[FileNo]; thisFile = new;          if(thisFile.isFile())          {              String thisFileName = thisFile.getName();              oLog.infoForced("Input file name in EDIClaimFile Activity is LOG 1 ->"+thisFileName);              long thisFileModified = thisFile.lastModified();               oLog.infoForced("Input file name in EDIClaimFile Activity is LOG 2 ->"+thisFileModified);              if(thisFileName.contains(".xml") || thisFileName.contains(".XML"))              {                   if(thisFileModified > lastModified)                   {                        fileName = thisFileName.substring(0,thisFileName.indexOf(".")) + ".xml";                                      oLog.infoForced("Input file name in EDIClaimFile Activity is LOG 3 ->"+fileName);

                       lastModified = thisFileModified;                   }               }          }

   } oLog.infoForced("Input file name in EDIClaimFile Activity is ->"+fileName);

} else { oLog.error("Invalid directory provided in EDIClaimFile Activity"); } } catch (Exception e) { oLog.error("Error getting input file name in EDIClaimFile Activity"); e.printStackTrace(); }




Pega Platform 8.2.2 Data Integration Java and Activities Insurance Lead System Architect