From a7a98c0f5170478bad7a95bc4b84edaa241e600c Mon Sep 17 00:00:00 2001 From: gexce Date: Thu, 17 Aug 2017 16:40:34 +0200 Subject: [PATCH] CropAssetCopyTool --- .../src/com/bayer/edam/excelimport/CropAssetCopyTool.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java b/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java index aedc1ad..94eb563 100644 --- a/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java +++ b/Toolbox Migration/src/com/bayer/edam/excelimport/CropAssetCopyTool.java @@ -155,19 +155,19 @@ public class CropAssetCopyTool { if (targetFile.exists()) { while (targetFile.exists()) { String oldName = FilenameUtils.removeExtension(targetFile.getName()); - String newName = oldName + "--002." + FilenameUtils.getExtension(oldName); + String extension = FilenameUtils.getExtension(targetFile.getName()); + String newName = oldName + "--002." + extension; if (oldName.length() > 5 && oldName.charAt(oldName.length() - 4) == '-' && oldName.charAt(oldName.length() - 3) == '-' && StringUtils.isNumeric(oldName.substring(oldName.length() - 3))) { int num = Integer.parseInt(oldName.substring(oldName.length() - 3)); num++; - newName = oldName.substring(0, oldName.length() - 3) + String.format("%03d", num) + "." - + FilenameUtils.getExtension(targetFile.getName()); + newName = oldName.substring(0, oldName.length() - 3) + String.format("%03d", num) + "." + extension; } targetFile = new File(targetDir + "\\" + newName); } - log.info("(AssetID " + assetId + ") Target file '" + targetName + "' already exists. Copy file as '" + targetFile.getName() + "'"); + log.info("(AssetID " + assetId + ") Target file '" + targetName + "' already exists. Copy file as '" + targetFile.getName() + "'"); line[1] = targetFile.getName(); }