return;
}
}
// get filename
FtpFile file = null;
try {
file = session.getFileSystemView().getFile(fileName);
} catch (Exception ex) {
LOG.debug("Exception getting file object", ex);
}
if (file == null) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
"STOR.invalid", fileName));
return;
}
fileName = file.getAbsolutePath();
// get permission
if (!file.isWritable()) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
"STOR.permission", fileName));
return;
}
// get data connection
session.write(
LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_150_FILE_STATUS_OKAY, "STOR",
fileName)).awaitUninterruptibly(10000);
DataConnection dataConnection;
try {
dataConnection = session.getDataConnection().openConnection();
} catch (Exception e) {
LOG.debug("Exception getting the input data stream", e);
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "STOR",
fileName));
return;
}
// transfer data
boolean failure = false;
OutputStream outStream = null;
try {
outStream = file.createOutputStream(skipLen);
long transSz = dataConnection.transferFromClient(session.getFtpletSession(), outStream);
// attempt to close the output stream so that errors in
// closing it will return an error to the client (FTPSERVER-119)
if(outStream != null) {