FTP parsing remote file error
I am trying to parse remote xml file. when i check the path of the file using outDocFile.getCanonicalFile() , it is pointing to local("C:/ct-data/ald/erd/relDeletes) but the variable(outputLocation) is pointing to "/ct-data/ald/erd/relDeletes". because of this i'm getting outDocFile.exists() =null
please let me know, if i am missing anything.
here is the code:
Code:
String outputLocation= "/ct-data/ald/erd/relDeletes";
String oct= "entity-N_CCH-61874.xml";
try {
FTPClient ftp = new FTPClient();
ftp.connect(hostName);
ftp.login(username,password);
ftp.setFileType(FTP.BINARY_FILE_TYPE);
// ftp.changeWorkingDirectory("/ct-data/ald/erd/relDeletes");
int reply = ftp.getReplyCode();
System.out.println("Received Reply from FTP Connection:" + reply);
if(FTPReply.isPositiveCompletion(reply)){
System.out.println("Connected Success");
}
System.out.print("outputfile "+oct+ "\n"+outputLocation+"\n");
File outDocFile = new File(outputLocation,oct);
System.out.println("File path"+outDocFile.getCanonicalFile());
if(outDocFile.exists() )
{
InputStream stream= new FileInputStream(outDocFile);
DeleteFileParser del = new DeleteFileParser(entityWriters, relWriters, batchID, oct, fmConfig);
del.setInput(stream);
del.parse();
System.out.println("parsing done");
}
}
catch(Exception e)
{
System.out.println("Exception" +e.getMessage());
}
output:
Received Reply from FTP Connection:200
Connected Success
outputfile entity-N_CCH-61874.xml
/ct-data/ald/erd/relDeletes/
File path C:\ct-data\ald\erd\relDeletes\entity-N_CCH-61874.xml