git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorvasary.daniel <TFS\vasary.daniel>
Mon, 14 Feb 2022 20:25:42 +0000 (20:25 +0000)
committervasary.daniel <TFS\vasary.daniel>
Mon, 14 Feb 2022 20:25:42 +0000 (20:25 +0000)
server/user.jobengine.executors/src/user/jobengine/server/steps/CopyImagesStep.java

index 12be74e7c01ac168152d977464ee2812ca131905..4c69143071bc8c84c426fa9e46e868f00d1f5af8 100644 (file)
@@ -7,6 +7,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;\r
 import java.nio.file.Paths;\r
 import java.nio.file.SimpleFileVisitor;\r
+import java.nio.file.StandardCopyOption;\r
 import java.nio.file.attribute.BasicFileAttributes;\r
 import java.nio.file.attribute.FileTime;\r
 \r
@@ -30,7 +31,6 @@ public class CopyImagesStep extends JobStep {
                        public FileVisitResult visitFile(Path source, BasicFileAttributes attrs) throws IOException {\r
                                FileVisitResult result = FileVisitResult.CONTINUE;\r
 \r
-                               logger.info(getMarker(), "Checking path: {}", source.toString());\r
                                try {\r
                                        String fileName = source.getFileName().toString();\r
                                        String fileExtension = FilenameUtils.getExtension(source.toString()).toLowerCase();\r
@@ -39,8 +39,10 @@ public class CopyImagesStep extends JobStep {
 \r
                                        boolean needCopy = false;\r
 \r
-                                       if (!fileExtension.equals("jpg") && !fileExtension.equals("jpeg"))\r
+                                       if (!fileExtension.equals("jpg") && !fileExtension.equals("jpeg")) {\r
+                                               logger.info(getMarker(), "{} is not image", source.toString());\r
                                                return result;\r
+                                       }\r
 \r
                                        if (target.toFile().exists()) {\r
                                                FileTime sourceLastModified = Files.readAttributes(source, BasicFileAttributes.class)\r
@@ -80,7 +82,8 @@ public class CopyImagesStep extends JobStep {
        private void copyFile(Path source, Path target) {\r
                logger.info(getMarker(), "Copy needed for {}", source);\r
                try {\r
-                       Files.copy(source, target);\r
+                       Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);\r
+                       logger.info(getMarker(), "Success copy for {}", source);\r
                } catch (Exception e) {\r
                        logger.error(getMarker(), "Error synchronize {} to {}. System message: {}", source, target, e.getMessage());\r
                }\r