Skip to content

Commit 31b9fa0

Browse files
authored
Replace some deprecated FileUtils methods (#340)
1 parent 9328c20 commit 31b9fa0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ protected static String quotedPathArgument(String value) {
272272
}
273273

274274
/**
275-
* Convenience method that copy all <code>doc-files</code> directories from <code>javadocDir</code> to the
275+
* Convenience method that copies all <code>doc-files</code> directories from <code>javadocDir</code> to the
276276
* <code>outputDirectory</code>.
277277
*
278278
* @param outputDirectory the output directory
@@ -302,7 +302,7 @@ protected static void copyJavadocResources(File outputDirectory, File javadocDir
302302
javadocDir, "resources,**/doc-files", String.join(",", excludes), false, true);
303303
for (String docFile : docFiles) {
304304
File docFileOutput = new File(outputDirectory, docFile);
305-
FileUtils.mkdir(docFileOutput.getAbsolutePath());
305+
Files.createDirectories(Paths.get(docFileOutput.getAbsolutePath()));
306306
FileUtils.copyDirectoryStructure(new File(javadocDir, docFile), docFileOutput);
307307
List<String> files = FileUtils.getFileAndDirectoryNames(
308308
docFileOutput, String.join(",", excludes), null, true, true, true, true);
@@ -854,13 +854,12 @@ protected static void invokeMaven(
854854
*
855855
* @param javaFile not null
856856
* @param encoding could be null
857-
* @return the content with unified line separator of the given javaFile using the given encoding.
858-
* @see FileUtils#fileRead(File, String)
857+
* @return the content of the given javaFile using the given encoding
859858
* @since 2.6.1
860859
*/
861860
protected static String readFile(final File javaFile, final String encoding) {
862861
try {
863-
return FileUtils.fileRead(javaFile, encoding);
862+
return new String(Files.readAllBytes(javaFile.toPath()), Charset.forName(encoding));
864863
} catch (IOException e) {
865864
return null;
866865
}
@@ -878,7 +877,7 @@ protected static String readFile(final File javaFile, final String encoding) {
878877
*
879878
* @param path which can contain multiple paths separated with a colon (<code>:</code>) or a semi-colon
880879
* (<code>;</code>), platform independent. Could be null.
881-
* @return the path splitted by colon or semi-colon or <code>null</code> if path was <code>null</code>.
880+
* @return the path split by colon or semi-colon or <code>null</code> if path was <code>null</code>.
882881
* @since 2.6.1
883882
*/
884883
protected static String[] splitPath(final String path) {

0 commit comments

Comments
 (0)