You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2023/07/09 12:31:29 UTC

[maven-javadoc-plugin] branch scan created (now cdd7546c)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a change to branch scan
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


      at cdd7546c [MJAVADOC-755] prefer JDK and commons IO methods

This branch includes the following new commits:

     new cdd7546c [MJAVADOC-755] prefer JDK and commons IO methods

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-javadoc-plugin] 01/01: [MJAVADOC-755] prefer JDK and commons IO methods

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch scan
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit cdd7546c424f044fa6b9bbf8d4a0388dd9302d29
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sun Jul 9 08:31:16 2023 -0400

    [MJAVADOC-755] prefer JDK and commons IO methods
---
 .../java/org/apache/maven/plugins/javadoc/JavadocUtil.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index 4e4e2c67..397001eb 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -41,6 +41,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -284,15 +285,15 @@ public class JavadocUtil {
                 javadocDir, "resources,**/doc-files", String.join(",", excludes), false, true);
         for (String docFile : docFiles) {
             File docFileOutput = new File(outputDirectory, docFile);
-            FileUtils.mkdir(docFileOutput.getAbsolutePath());
-            FileUtils.copyDirectoryStructure(new File(javadocDir, docFile), docFileOutput);
+            Files.createDirectory(Paths.get(docFileOutput.getAbsolutePath()));
+            org.apache.commons.io.FileUtils.copyDirectory(new File(javadocDir, docFile), docFileOutput);
             List<String> files = FileUtils.getFileAndDirectoryNames(
                     docFileOutput, String.join(",", excludes), null, true, true, true, true);
             for (String filename : files) {
                 File file = new File(filename);
 
                 if (file.isDirectory()) {
-                    FileUtils.deleteDirectory(file);
+                    org.apache.commons.io.FileUtils.deleteDirectory(file);
                 } else {
                     file.delete();
                 }
@@ -698,7 +699,7 @@ public class JavadocUtil {
             throw new IOException("The url could not be null.");
         }
 
-        FileUtils.copyURLToFile(url, file);
+        Files.copy(url.openStream(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
     }
 
     /**
@@ -820,12 +821,11 @@ public class JavadocUtil {
      * @param javaFile not null
      * @param encoding could be null
      * @return the content with unified line separator of the given javaFile using the given encoding.
-     * @see FileUtils#fileRead(File, String)
      * @since 2.6.1
      */
     protected static String readFile(final File javaFile, final String encoding) {
         try {
-            return FileUtils.fileRead(javaFile, encoding);
+            return new String(Files.readAllBytes(javaFile.toPath()), encoding);
         } catch (IOException e) {
             return null;
         }