XenoAmess commented on a change in pull request #48:
URL: 
https://github.com/apache/maven-javadoc-plugin/pull/48#discussion_r443134231



##########
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:
       > Then try with resources isn't working right here somehow. You 
shouldn't need to catch IOException that's only thrown on autoclose.
   @elharo 
   Well, kind of agreed, but that is oracle guys' dicision for forcing us to 
must catch it...
   Or should we revert it back to normal try instead of try-with-resource?

##########
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:
       > Then try with resources isn't working right here somehow. You 
shouldn't need to catch IOException that's only thrown on autoclose.
   
   @elharo 
   Well, kind of agreed, but that is oracle guys' dicision for forcing us to 
must catch it...
   Or should we revert it back to normal try instead of try-with-resource?




----------------------------------------------------------------
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]


Reply via email to