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 2024/12/04 10:26:46 UTC

(maven-javadoc-plugin) branch master updated: Replace some deprecated FileUtils methods (#340)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 31b9fa00 Replace some deprecated FileUtils methods (#340)
31b9fa00 is described below

commit 31b9fa005ecdd2ac59acfe46330f0d3f3f11bc02
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Wed Dec 4 10:26:41 2024 +0000

    Replace some deprecated FileUtils methods (#340)
---
 .../java/org/apache/maven/plugins/javadoc/JavadocUtil.java    | 11 +++++------
 1 file changed, 5 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 c8178dd6..df847ed5 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -272,7 +272,7 @@ public class JavadocUtil {
     }
 
     /**
-     * Convenience method that copy all <code>doc-files</code> directories from <code>javadocDir</code> to the
+     * Convenience method that copies all <code>doc-files</code> directories from <code>javadocDir</code> to the
      * <code>outputDirectory</code>.
      *
      * @param outputDirectory the output directory
@@ -302,7 +302,7 @@ 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());
+            Files.createDirectories(Paths.get(docFileOutput.getAbsolutePath()));
             FileUtils.copyDirectoryStructure(new File(javadocDir, docFile), docFileOutput);
             List<String> files = FileUtils.getFileAndDirectoryNames(
                     docFileOutput, String.join(",", excludes), null, true, true, true, true);
@@ -854,13 +854,12 @@ 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)
+     * @return the content of the given javaFile using the given encoding
      * @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()), Charset.forName(encoding));
         } catch (IOException e) {
             return null;
         }
@@ -878,7 +877,7 @@ public class JavadocUtil {
      *
      * @param path which can contain multiple paths separated with a colon (<code>:</code>) or a semi-colon
      *            (<code>;</code>), platform independent. Could be null.
-     * @return the path splitted by colon or semi-colon or <code>null</code> if path was <code>null</code>.
+     * @return the path split by colon or semi-colon or <code>null</code> if path was <code>null</code>.
      * @since 2.6.1
      */
     protected static String[] splitPath(final String path) {