diff --git a/pom.xml b/pom.xml
index 9e529c4da..414bc337b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -243,6 +243,13 @@ under the License.
org.apache.maven.doxia
doxia-site-renderer
${doxia-sitetoolsVersion}
+
+
+
+ org.apache.velocity
+ velocity-tools
+
+
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index af3eb67e8..979d253f7 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -543,7 +543,7 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
private boolean detectOfflineLinks;
/**
- * Detect the Java API link for the current build, i.e. https://docs.oracle.com/javase/1.4.2/docs/api/
+ * Detect the Java API link for the current build, e.g. https://docs.oracle.com/javase/1.4.2/docs/api/
* for Java source 1.4.
*
* By default, the goal detects the Javadoc API link depending the value of the source
@@ -3767,7 +3767,7 @@ private Set getLinkofflines() throws MavenReportException {
* If {@code detectLinks}, try to add javadoc apidocs according Maven conventions for all dependencies given
* in the project.
*
- * According the Javadoc documentation, all defined link should have ${link}/package-list
fetchable.
+ * According the Javadoc documentation, all defined links should have ${link}/package-list
fetchable.
*
* Note: when a link is not fetchable:
*
@@ -3802,7 +3802,7 @@ private void addLinkArguments(List arguments) throws MavenReportExceptio
}
/**
- * Coppy all resources to the output directory
+ * Copy all resources to the output directory.
*
* @param javadocOutputDirectory not null
* @throws MavenReportException if any
@@ -5725,7 +5725,7 @@ private Set followLinks(Set links) {
try {
redirectLinks.add(JavadocUtil.getRedirectUrl(new URI(link).toURL(), settings)
.toString());
- } catch (Exception e) {
+ } catch (IOException e) {
// only print in debug, it should have been logged already in warn/error because link isn't valid
getLog().debug("Could not follow " + link + ". Reason: " + e.getMessage());
@@ -5733,6 +5733,9 @@ private Set followLinks(Set links) {
// incomplete redirect configuration on the server side.
// This partially restores the previous behaviour before fix for MJAVADOC-427
redirectLinks.add(link);
+ } catch (URISyntaxException | IllegalArgumentException e) {
+ // only print in debug, it should have been logged already in warn/error because link isn't valid
+ getLog().debug("Could not follow " + link + ". Reason: " + e.getMessage());
}
}
return redirectLinks;
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 db7ef042c..0da8bb1a2 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -1218,7 +1218,7 @@ static List toList(T single, T[] multiple) {
return result;
}
- // TODO: move to plexus-utils or use something appropriate from there
+ // TODO: deprecate in favor of Path.relativize
public static String toRelative(File basedir, String absolutePath) {
String relative;
@@ -1259,13 +1259,13 @@ public static boolean isEmpty(final Collection> collection) {
}
/**
- * Execute an Http request at the given URL, follows redirects, and returns the last redirect locations. For URLs
+ * Execute an HTTP request to the given URL, follow redirects, and return the last redirect location. For URLs
* that aren't http/https, this does nothing and simply returns the given URL unchanged.
*
- * @param url URL.
- * @param settings Maven settings.
- * @return Last redirect location.
- * @throws IOException if there was an error during the Http request.
+ * @param url URL
+ * @param settings Maven settings
+ * @return final URL after all redirects have been followed
+ * @throws IOException if there was an error during the HTTP request
*/
protected static URL getRedirectUrl(URL url, Settings settings) throws IOException {
String protocol = url.getProtocol();