gnodet commented on code in PR #1197:
URL: https://github.com/apache/maven/pull/1197#discussion_r1253421341


##########
maven-core/src/main/java/org/apache/maven/internal/transformation/ConsumerPomArtifactTransformer.java:
##########
@@ -165,31 +178,50 @@ private ConsumerPomArtifact(MavenProject mavenProject, 
Path target, RepositorySy
                     target,
                     transformer(session));
         }
+    }
 
-        private static BiConsumer<Path, Path> 
transformer(RepositorySystemSession session) {
-            TransformerContext context = (TransformerContext) 
session.getData().get(TransformerContext.KEY);
-            return (src, dest) -> {
-                try (InputStream inputStream = transform(src, context)) {
-                    Files.createDirectories(dest.getParent());
-                    Files.copy(inputStream, dest, 
StandardCopyOption.REPLACE_EXISTING);
-                } catch (XMLStreamException | IOException e) {
-                    throw new RuntimeException(e);
-                }
-            };
-        }
+    BiConsumer<Path, Path> transformer(RepositorySystemSession session) {
+        TransformerContext context = (TransformerContext) 
session.getData().get(TransformerContext.KEY);
+        return (src, dest) -> {
+            try {
+                Files.createDirectories(dest.getParent());
+                transform(src, dest, context);
+            } catch (XMLStreamException | IOException e) {
+                throw new RuntimeException(e);

Review Comment:
   So you want me to define an interface with `throw Exception` just to avoid 
using unchecked exception ?
   Worse, define a new interface + exception type, both would only be used in 
this context, just to wrap another checked exception for the sole purpose of 
not using unchecked exceptions ?
   Again, that's a more general discussion we can have, but I don't think it's 
the right place.  Feel free to start a discussion thread on exception handling 
in the v4 api on the mailing list.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to