@@ -5421,7 +5421,7 @@ private URL getResource(final List<String> classPath, final String resource) {
5421
5421
for (String filename : classPath ) {
5422
5422
try {
5423
5423
urls .add (new File (filename ).toURI ().toURL ());
5424
- } catch (MalformedURLException e ) {
5424
+ } catch (MalformedURLException | IllegalArgumentException e ) {
5425
5425
getLog ().error ("MalformedURLException: " + e .getMessage ());
5426
5426
}
5427
5427
}
@@ -5758,8 +5758,11 @@ private Set<String> followLinks(Set<String> links) {
5758
5758
Set <String > redirectLinks = new LinkedHashSet <>(links .size ());
5759
5759
for (String link : links ) {
5760
5760
try {
5761
- redirectLinks .add (JavadocUtil .getRedirectUrl (new URI (link ).toURL (), settings )
5762
- .toString ());
5761
+ redirectLinks .add (
5762
+ JavadocUtil .getRedirectUrl (new URL (link ), settings ).toString ());
5763
+ } catch (MalformedURLException | IllegalArgumentException e ) {
5764
+ // only print in debug, it should have been logged already in warn/error because link isn't valid
5765
+ getLog ().debug ("Could not follow " + link + ". Reason: " + e .getMessage ());
5763
5766
} catch (IOException e ) {
5764
5767
// only print in debug, it should have been logged already in warn/error because link isn't valid
5765
5768
getLog ().debug ("Could not follow " + link + ". Reason: " + e .getMessage ());
@@ -5768,9 +5771,6 @@ private Set<String> followLinks(Set<String> links) {
5768
5771
// incomplete redirect configuration on the server side.
5769
5772
// This partially restores the previous behaviour before fix for MJAVADOC-427
5770
5773
redirectLinks .add (link );
5771
- } catch (URISyntaxException | IllegalArgumentException e ) {
5772
- // only print in debug, it should have been logged already in warn/error because link isn't valid
5773
- getLog ().debug ("Could not follow " + link + ". Reason: " + e .getMessage ());
5774
5774
}
5775
5775
}
5776
5776
return redirectLinks ;
@@ -5818,6 +5818,7 @@ protected boolean isValidJavadocLink(String link, boolean detecting) {
5818
5818
return true ;
5819
5819
}
5820
5820
} catch (IOException e ) {
5821
+ // ignore this because it is optional
5821
5822
}
5822
5823
5823
5824
if (JavadocUtil .isValidPackageList (packageListUri .toURL (), settings , validateLinks )) {
@@ -5835,12 +5836,12 @@ protected boolean isValidJavadocLink(String link, boolean detecting) {
5835
5836
}
5836
5837
5837
5838
return false ;
5838
- } catch (URISyntaxException e ) {
5839
+ } catch (URISyntaxException | MalformedURLException | IllegalArgumentException e ) {
5839
5840
if (getLog ().isErrorEnabled ()) {
5840
5841
if (detecting ) {
5841
- getLog ().warn ("Malformed link: " + e .getInput () + ". Ignored it." );
5842
+ getLog ().warn ("Malformed link: " + e .getMessage () + ". Ignored it." );
5842
5843
} else {
5843
- getLog ().error ("Malformed link: " + e .getInput () + ". Ignored it." );
5844
+ getLog ().error ("Malformed link: " + e .getMessage () + ". Ignored it." );
5844
5845
}
5845
5846
}
5846
5847
return false ;
0 commit comments