You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2022/08/16 10:05:12 UTC
[cxf] branch 3.5.x-fixes updated: [CXF-8749]:Existing handler file fails the compile generated java source files
This is an automated email from the ASF dual-hosted git repository.
ema pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.5.x-fixes by this push:
new 59ced80686 [CXF-8749]:Existing handler file fails the compile generated java source files
59ced80686 is described below
commit 59ced806869ba5ce969274baa063e97cf9ed952d
Author: Jim Ma <em...@apache.org>
AuthorDate: Mon Aug 15 10:10:46 2022 +0800
[CXF-8749]:Existing handler file fails the compile generated java source files
---
.../src/main/java/org/apache/cxf/tools/common/ClassUtils.java | 8 ++++++--
.../src/main/java/org/apache/cxf/tools/common/Messages.properties | 3 ++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java b/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java
index 12ed3327fa..2b3ac65e6b 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/common/ClassUtils.java
@@ -21,6 +21,7 @@ package org.apache.cxf.tools.common;
import java.io.File;
import java.io.IOException;
+import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -29,6 +30,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.cxf.common.i18n.Message;
@@ -97,8 +99,10 @@ public class ClassUtils {
try {
Files.copy(otherFile,
- Files.createDirectories(Paths.get(targetDir, dirName)).resolve(str));
-
+ Files.createDirectories(Paths.get(targetDir, dirName)).resolve(str));
+ } catch (FileAlreadyExistsException existsException) {
+ LOG.log(Level.WARNING, "EXIST_RESOURCE_FILE",
+ Paths.get(targetDir, dirName).resolve(str));
} catch (IOException e) {
Message msg = new Message("FAIL_TO_COPY_GENERATED_RESOURCE_FILE", LOG);
throw new ToolException(msg, e);
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties b/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties
index 02534cee3f..368f863192 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties
+++ b/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties
@@ -31,4 +31,5 @@ TEMPLATE_MISSING = Could not find Velocity template file: {0}
VELOCITY_ENGINE_WRITE_ERRORS = Velocity engine write errors
FAIL_TO_WRITE_FILE = Failed to write file: {0}
FAIL_TO_COMPILE_GENERATE_CODES = Failed to compile generated code
-
+FAIL_TO_COPY_GENERATED_RESOURCE_FILE = Failed to copy generated resource file
+EXIST_RESOURCE_FILE = "Resource file already exists: {0}"