Skip to content

Commit

Permalink
Replace some deprecated FileUtils methods (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored Dec 4, 2024
1 parent 9328c20 commit 31b9fa0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected static String quotedPathArgument(String value) {
}

/**
* 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
Expand Down Expand Up @@ -302,7 +302,7 @@ protected static void copyJavadocResources(File outputDirectory, File javadocDir
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);
Expand Down Expand Up @@ -854,13 +854,12 @@ protected static void invokeMaven(
*
* @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;
}
Expand All @@ -878,7 +877,7 @@ protected static String readFile(final File javaFile, final String encoding) {
*
* @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) {
Expand Down

0 comments on commit 31b9fa0

Please sign in to comment.