This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf-xjc-utils.git
The following commit(s) were added to refs/heads/main by this push:
new fb410f6 Eliminate superfluous dependendencies from cxf-xjc-javadoc
(#324)
fb410f6 is described below
commit fb410f6dd57bf85634aa2a623570b6af430c5e27
Author: Peter Palaga <[email protected]>
AuthorDate: Thu May 14 16:39:11 2026 +0200
Eliminate superfluous dependendencies from cxf-xjc-javadoc (#324)
---
javadoc/pom.xml | 38 ++-----------------
.../apache/cxf/xjc/javadoc/JavadocPluginTest.java | 43 ++++++++++++++++++----
2 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/javadoc/pom.xml b/javadoc/pom.xml
index 468e56c..a28ed1b 100644
--- a/javadoc/pom.xml
+++ b/javadoc/pom.xml
@@ -6,9 +6,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -23,13 +23,13 @@
<packaging>jar</packaging>
<name>Apache CXF XJC JavaDoc Plugin</name>
<url>https://cxf.apache.org</url>
-
+
<parent>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>xjc-utils</artifactId>
<version>4.2.1-SNAPSHOT</version>
</parent>
-
+
<dependencies>
<dependency>
@@ -44,30 +44,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.equinox.app</artifactId>
- <version>1.7.600</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.equinox.registry</artifactId>
- <version>3.12.600</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.24.100</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.equinox.common</artifactId>
- <version>3.20.300</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
@@ -75,11 +51,5 @@
<version>3.45.0</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.cedarsoft.commons</groupId>
- <artifactId>io</artifactId>
- <version>8.9.2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
diff --git
a/javadoc/src/test/java/org/apache/cxf/xjc/javadoc/JavadocPluginTest.java
b/javadoc/src/test/java/org/apache/cxf/xjc/javadoc/JavadocPluginTest.java
index f18023b..11ff42f 100644
--- a/javadoc/src/test/java/org/apache/cxf/xjc/javadoc/JavadocPluginTest.java
+++ b/javadoc/src/test/java/org/apache/cxf/xjc/javadoc/JavadocPluginTest.java
@@ -20,19 +20,24 @@ package org.apache.cxf.xjc.javadoc;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import com.sun.tools.xjc.BadCommandLineException;
import com.sun.tools.xjc.Driver;
import com.sun.tools.xjc.Plugin;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
@@ -64,7 +69,32 @@ public class JavadocPluginTest extends Assert {
@Before
public void deleteAllGeneratedFiles() throws IOException {
File generatedFilesDir = new File(OUTPUT_DIR, PACKAGE_DIR);
- FileUtils.deleteDirectory(generatedFilesDir);
+
+ if (generatedFilesDir.exists()) {
+ Path origPath = generatedFilesDir.toPath();
+ Path randomDest = Paths.get(origPath.toString() + "-" +
UUID.randomUUID());
+ Files.move(origPath, randomDest);
+
+ Files.walkFileTree(randomDest, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs)
+ throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir,
IOException exc)
+ throws IOException {
+ if (exc != null) {
+ throw exc;
+ }
+
+ Files.delete(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
}
@Test
@@ -206,9 +236,8 @@ public class JavadocPluginTest extends Assert {
}
private CompilationUnit parseSourceFile(String fileName) throws
IOException, FileNotFoundException {
- FileReader inputFile = new FileReader(new File(OUTPUT_DIR + "/" +
PACKAGE_DIR, fileName));
- char[] classChars = IOUtils.toCharArray(inputFile);
- inputFile.close();
+ byte[] bytes = Files.readAllBytes(Paths.get(OUTPUT_DIR + "/" +
PACKAGE_DIR, fileName));
+ char[] classChars = new String(bytes,
StandardCharsets.UTF_8).toCharArray();
ASTParser parser = ASTParser.newParser(AST.JLS3);
@SuppressWarnings("rawtypes")
Map options = JavaCore.getOptions();