\r
String md5String = DatatypeConverter.printHexBinary(digest).toUpperCase();\r
logger.info("calculated MD5 hash= {}", md5String);\r
+ dis.close();\r
+ is.close();\r
return new Object[] { md5String };\r
}\r
}
\ No newline at end of file
\r
String md5String = DatatypeConverter.printHexBinary(digest).toUpperCase();\r
logger.info("calculated MD5 hash= {}", md5String);\r
+ dis.close();\r
+ is.close();\r
return new Object[] { md5String };\r
}\r
}
\ No newline at end of file
Path templatesPath = null;\r
String filePath = null;\r
String duplicateFileName = null;\r
+ InputStream is = null;\r
try {\r
templatesPath = Paths.get(systemConfig.getConfig(DIR_TEMPLATES));\r
duplicateFileName = FilenameUtils.getName(selectedJob.getString("template")).replace(".xml", "")\r
duplicateFileName = FilenameUtils.getName(duplicateFileName).replace(".xml", "").concat("-copy.xml");\r
filePath = templatesPath.toString() + FileSystems.getDefault().getSeparator() + duplicateFileName;\r
}\r
- InputStream is = new FileInputStream(templatesPath.toString() + FileSystems.getDefault().getSeparator()\r
+ is = new FileInputStream(templatesPath.toString() + FileSystems.getDefault().getSeparator()\r
+ selectedJob.getString("template"));\r
Files.copy(is, Paths.get(filePath));\r
} catch (FileNotFoundException e) {\r
logger.error("File not found: {}", filePath);\r
} catch (IOException e) {\r
logger.error("IOException: {}", e.getCause());\r
+ } finally {\r
+ if (is != null) {\r
+ try {\r
+ is.close();\r
+ } catch (IOException e) {\r
+ logger.error("IOException: {}", e.getCause());\r
+ }\r
+ }\r
}\r
return duplicateFileName;\r
\r