IDEMPIERE-2544:to more warning compiler hidden good warning

This commit is contained in:
hieplq 2017-05-17 21:55:20 +07:00
parent 768762d32a
commit 79f8edf12f
1 changed files with 18 additions and 8 deletions

View File

@ -76,6 +76,8 @@ public class AttachmentFileSystem implements IAttachmentStore {
if (log.isLoggable(Level.FINE)) log.fine("move file: " + path); if (log.isLoggable(Level.FINE)) log.fine("move file: " + path);
FileChannel in = null; FileChannel in = null;
FileChannel out = null; FileChannel out = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try { try {
//create destination folder //create destination folder
StringBuilder msgfile = new StringBuilder().append(attachmentPathRoot).append(File.separator).append(getAttachmentPathSnippet(attach)); StringBuilder msgfile = new StringBuilder().append(attachmentPathRoot).append(File.separator).append(getAttachmentPathSnippet(attach));
@ -88,11 +90,11 @@ public class AttachmentFileSystem implements IAttachmentStore {
msgfile = new StringBuilder().append(attachmentPathRoot).append(File.separator) msgfile = new StringBuilder().append(attachmentPathRoot).append(File.separator)
.append(getAttachmentPathSnippet(attach)).append(File.separator).append(entryFile.getName()); .append(getAttachmentPathSnippet(attach)).append(File.separator).append(entryFile.getName());
final File destFile = new File(msgfile.toString()); final File destFile = new File(msgfile.toString());
in = new FileInputStream(entryFile).getChannel(); fis = new FileInputStream(entryFile);
out = new FileOutputStream(destFile).getChannel(); in = fis.getChannel();
fos = new FileOutputStream(destFile);
out = fos.getChannel();
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
in.close();
out.close();
/* IDEMPIERE-2864 /* IDEMPIERE-2864
if(entryFile.exists()){ if(entryFile.exists()){
if(!entryFile.delete()){ if(!entryFile.delete()){
@ -107,11 +109,19 @@ public class AttachmentFileSystem implements IAttachmentStore {
+ attachmentPathRoot + File.separator + + attachmentPathRoot + File.separator +
getAttachmentPathSnippet(attach) + File.separator + entryFile.getName()); getAttachmentPathSnippet(attach) + File.separator + entryFile.getName());
} finally { } finally {
if (in != null && in.isOpen()) { if (fis != null) {
in.close(); try{
fis.close();
}catch(Exception e) {
//do nothing
}
} }
if (out != null && out.isOpen()) { if (fos != null) {
out.close(); try{
fos.close();
}catch(Exception e) {
//do nothing
}
} }
} }
} }