You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/02/06 20:48:17 UTC

[GitHub] [maven] gnodet commented on a change in pull request #669: Use try-with-resources

gnodet commented on a change in pull request #669:
URL: https://github.com/apache/maven/pull/669#discussion_r800231267



##########
File path: maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
##########
@@ -216,9 +216,10 @@ private PluginDescriptor extractPluginDescriptor( Artifact pluginArtifact, Plugi
 
                     if ( pluginDescriptorEntry != null )
                     {
-                        InputStream is = pluginJar.getInputStream( pluginDescriptorEntry );
-
-                        pluginDescriptor = parsePluginDescriptor( is, plugin, pluginFile.getAbsolutePath() );
+                        try ( InputStream is = pluginJar.getInputStream( pluginDescriptorEntry ) )

Review comment:
       I tend to disagree because the `Closeable#close()` method is explicitely described as being idempotent.  Else, the same applies to the call to `builder.build()` inside the `parsePluginDescriptor` which also closes the given stream.




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

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org