FTPClient locks file after "put" throws exception. The lock is still there even after "quit" method is called.
FTPClient ftp_client = null;
try{
ftp_client = getFTPClient();
ftp_client.chdir(workingRemoteFilePath);
ftp_client.put( workingLocalFile.getPath(), workingRemoteFileName );
ftpUploadSuccessful = true;
processSession.addAudit(this, "File " + workingLocalFile + " uploaded to " +
workingRemoteFilePath + "\\" + workingRemoteFileName );
}catch(Exception e){
processSession.addErrorAudit(this, "Exception uploading file " + workingLocalFile + " to " +
workingRemoteFilePath + "\\" + workingRemoteFileName, e );
throw e;
}finally{
/* quite to release local file */
if (ftp_client != null){
if ( LOG.isDebugEnabled() ) LOG.debug("Quitting FTP Client");
try{ftp_client.quit();}
catch(Exception e){LOG.error("Exception quitting FTPClient", e);}
}
System.out.println("LLLLLLLLLLLLLLLLLLLLLLLLLLL " +
workingLocalFile.delete() );
}
output:
[java] DEBUG [main] process.FTPProcessComponent (?:?) - Quitting FTP Client
[java] LLLLLLLLLLLLLLLLLLLLLLLLLLL false