Skip to content
Permalink
Browse files
[CXF-8749]:Existing handler file fails the compile generated java sou…
…rce files
  • Loading branch information
jimma committed Aug 16, 2022
1 parent dcdf6c5 commit 4e110842a36ac1923870df2c4b9f1a3266dfbc80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
@@ -21,6 +21,7 @@

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.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;
@@ -94,11 +96,12 @@ public void compile(ToolContext context) throws ToolException {
&& str.regionMatches(true, str.length() - suffix.length(), suffix, 0, suffix.length())
&& context.get(ToolConstants.CFG_CLASSDIR) != null) {
String targetDir = (String)context.get(ToolConstants.CFG_CLASSDIR);

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);
@@ -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}"

0 comments on commit 4e11084

Please sign in to comment.