Skip to content

Commit 1085259

Browse files
authored
Use Java 7 relativization instead of our hand-rolled code (#381)
* Use Java 7 relativization instead of our hand-rolled code
1 parent 056ecb1 commit 1085259

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
import static org.apache.maven.plugins.javadoc.JavadocUtil.toRelative;
146146

147147
/**
148-
* Base class with majority of Javadoc functionalities.
148+
* Base class with the majority of Javadoc functionality.
149149
*
150150
* @author <a href="mailto:[email protected]">Brett Porter</a>
151151
* @author <a href="mailto:[email protected]">Vincent Siveton</a>
@@ -2177,12 +2177,15 @@ protected Collection<JavadocModule> getSourcePaths() throws MavenReportException
21772177
}
21782178

21792179
if (getJavadocDirectory() != null) {
2180-
String javadocDirRelative = PathUtils.toRelative(
2181-
project.getBasedir(), getJavadocDirectory().getAbsolutePath());
2182-
File javadocDir = new File(subProject.getBasedir(), javadocDirRelative);
2183-
if (javadocDir.exists() && javadocDir.isDirectory()) {
2180+
Path base = project.getBasedir().toPath();
2181+
Path relative = base.relativize(
2182+
getJavadocDirectory().toPath().toAbsolutePath());
2183+
Path javadocDir = subProject.getBasedir().toPath().resolve(relative);
2184+
if (Files.isDirectory(javadocDir)) {
21842185
Collection<Path> l = JavadocUtil.pruneDirs(
2185-
subProject, Collections.singletonList(javadocDir.getAbsolutePath()));
2186+
subProject,
2187+
Collections.singletonList(
2188+
javadocDir.toAbsolutePath().toString()));
21862189
additionalSourcePaths.addAll(l);
21872190
}
21882191
}

0 commit comments

Comments
 (0)