• Post Reply Bookmark Topic Watch Topic
  • New Topic

UNIX file delivery failed: Map failed  RSS feed

 
sup rty
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, If any one has any idea regarding the following error, please revert:
while using COPY over UNIX command i am getting following error:
file delivery failed: Map failed
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you try to copy the file? The code that does this would be great. Please TellTheDetails.
 
sup rty
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi rob here is the code...we are trying to copy using unix copy link command. please throw some light on it.
there is something wrong with the try block.

protected String copyFile(DeliveryFileBean fileBean, String sourceFileName, String destFileName) throws TransferException {


File sourceFile;
File destFile;

FileChannel srcChannel = null;
FileChannel destChannel = null;


String extensionOrg = "";
String fileWithoutExt = "";

String fileDeliveryTemp = "";

try {
boolean bAppend = false;
sourceFile = new File(sourceFileName);

if (!sourceFile.exists()||sourceFile.length()<=0){
throw new Exception("Local File '" + sourceFile +
"' does not exist" + " localSize: " + sourceFile.length());
}



extensionOrg = destFileName.substring(destFileName.lastIndexOf('.')+1, destFileName.length());


fileWithoutExt = destFileName.substring(0, destFileName.lastIndexOf('.'));

fileDeliveryTemp = fileWithoutExt + fileBean.getTmpFileExt() + ".tmp";


srcChannel = new FileInputStream(sourceFile).getChannel();


destChannel = new FileOutputStream(fileDeliveryTemp).getChannel();
destChannel.transferFrom(srcChannel, 0, srcChannel.size());


destFile = new File(fileDeliveryTemp);


if (sourceFile.length() == destFile.length()) {

s_logger.debug("end copyFile");


s_logger.debug("rename from tmp extension to original extension: " + extensionOrg);
File renamedFile = new File(fileWithoutExt + "." + extensionOrg);

String fileSize = Long.toString(destFile.length());
destFile.renameTo(renamedFile);


return fileSize;
}
else {

throw new Exception("Filesize couldn't be verified, source filesize '" +
sourceFile.length() + "' != " + "copied filesize '" +
destFile.length() + "'");
}

} catch (Exception ex) {
s_logger.debug("error while uploading file");

try {
if (srcChannel != null) {
srcChannel.close();
}
if (destChannel != null) {
destChannel.close();
}
} catch (IOException ioex) {
s_logger.debug("error while closing/flushing input/ouptut streams: " +
ioex.getMessage());
}
sourceFile = null;
destFile = null;

throw new TransferException(ex.getMessage());
}
}
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
supratimC chakraborty, please go back to your post, use the "edit" button and add the code tags to your code, and make sure it is correctly indented. It is very difficult to read otherwise.
 
sup rty
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still difficult to read, why not format it like this?
 
sup rty
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for formatting the code...kindly help if any one knows about the error...the try block of the code is not working and giving an error saying "file not delivered:Map failed"....this happens when file is being copied doing the copy link command of UNIX. this happens during coping of very big video files. if any one knows about it...please reply fast....this is a high priority bug to be fixed....thanks in advance
 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this ain't no bug, this is failure by design

why don't you use finally?

why are you catching your own exceptions?

why does have everything to be in one try/catch block?

why don't you pass the original exception in your TransferException?
Because it would make error analysis too easy?

Well, if we brake it down to bare minimums with some preliminary checking
my code would look something like this:



try this and add your bells and whistles later

and what I'm still not getting, where does it use the UNIX copy command?

Hope that helps
Matt
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!