XenoAmess commented on a change in pull request #48:
URL:
https://github.com/apache/maven-javadoc-plugin/pull/48#discussion_r443136388
##########
File path:
src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -6066,23 +6066,15 @@ private URL getResource( final List<String> classPath,
final String resource )
getLog().error( "MalformedURLException: " + e.getMessage() );
}
}
-
- URLClassLoader javadocClassLoader = new URLClassLoader( urls.toArray(
new URL[urls.size()] ), null );
- try
+ URL resourceURL = null;
+ try ( URLClassLoader javadocClassLoader = new URLClassLoader(
urls.toArray( new URL[urls.size()] ), null ) )
{
- return javadocClassLoader.getResource( resource );
- }
- finally
+ resourceURL = javadocClassLoader.getResource( resource );
+ } catch ( IOException e )
Review comment:
> There's something I'm not seeing here. Have you tried simply removing
the catch block completely? Does that compile?
after removing that part:
```
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 12.622 s
[INFO] Finished at: 2020-06-20T22:46:09+08:00
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)
on project maven-javadoc-plugin: Compilation failure
[ERROR]
/D:/workspace/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java:[6068,30]
unreported exception java.io.IOException; must be caught or declared to be
thrown
[ERROR] exception thrown from implicit call to close() on resource
variable 'javadocClassLoader'
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]