You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "timtebeek (via GitHub)" <gi...@apache.org> on 2023/03/19 21:48:57 UTC

[GitHub] [maven-doxia] timtebeek opened a new pull request, #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

timtebeek opened a new pull request, #156:
URL: https://github.com/apache/maven-doxia/pull/156

   For https://issues.apache.org/jira/browse/MNG-6825
   
   This third PR targets IOUtil, which was not present in apache/maven, hence I've targeted the project that uses it the most.
   
   Regrettably some manual fixes where needed, as the replacement commons-io IOUtils does not silently swallow IOExceptions like Plexus IOUtil did. Hence inlined the old behaviour a couple times and adopted try-with-resources a few other times.
   
   Not entirely happy both with the process for these replacements and with the outcomes. PR opened to gather feedback on whether we would want to target the other replacements similarly, or adopt a different approach, such as more try-with-resources, or no commons-io IOUtils.


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


[GitHub] [maven-doxia] timtebeek commented on a diff in pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "timtebeek (via GitHub)" <gi...@apache.org>.
timtebeek commented on code in PR #156:
URL: https://github.com/apache/maven-doxia/pull/156#discussion_r1141969237


##########
doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java:
##########
@@ -110,7 +110,7 @@ public final void testTestDocument() throws IOException {
             SinkTestDocument.generate(testSink);
         } finally {
             testSink.close();
-            IOUtil.close(writer);
+            IOUtils.close(writer);

Review Comment:
   It's `Sink.close()` documented as that it should:
   ```java
       /**
        * Close the writer or the stream, if needed.
        * Closing a previously-closed Sink has no effect.
        */
       void close();
   ```
   So I'll go ahead and make that change here.



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


[GitHub] [maven-doxia] timtebeek commented on a diff in pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "timtebeek (via GitHub)" <gi...@apache.org>.
timtebeek commented on code in PR #156:
URL: https://github.com/apache/maven-doxia/pull/156#discussion_r1141969237


##########
doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java:
##########
@@ -110,7 +110,7 @@ public final void testTestDocument() throws IOException {
             SinkTestDocument.generate(testSink);
         } finally {
             testSink.close();
-            IOUtil.close(writer);
+            IOUtils.close(writer);

Review Comment:
   It's `Sink.close()` documented as that it should:



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


[GitHub] [maven-doxia] elharo commented on a diff in pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #156:
URL: https://github.com/apache/maven-doxia/pull/156#discussion_r1141490692


##########
doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java:
##########
@@ -110,7 +110,7 @@ public final void testTestDocument() throws IOException {
             SinkTestDocument.generate(testSink);
         } finally {
             testSink.close();
-            IOUtil.close(writer);
+            IOUtils.close(writer);

Review Comment:
   This one might be able to use try with resources.



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


[GitHub] [maven-doxia] elharo merged pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo merged PR #156:
URL: https://github.com/apache/maven-doxia/pull/156


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


[GitHub] [maven-doxia] timtebeek commented on a diff in pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "timtebeek (via GitHub)" <gi...@apache.org>.
timtebeek commented on code in PR #156:
URL: https://github.com/apache/maven-doxia/pull/156#discussion_r1141764135


##########
doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java:
##########
@@ -110,7 +110,7 @@ public final void testTestDocument() throws IOException {
             SinkTestDocument.generate(testSink);
         } finally {
             testSink.close();
-            IOUtil.close(writer);
+            IOUtils.close(writer);

Review Comment:
   Looked at this briefly, but `Sink` does not implement `AutoCloseable`, which makes it slightly awkward, especially as some of the multiple `Sink#close()` implementations call out to `init()` for instance, so leaving out `testSink.close()` is also not an option. You'd then have to declare `Sink` outside the try with resources, and close that through finally, which could change the order of the `close` calls if I'm not mistaken. Any other suggestions on how to handle this here?



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


[GitHub] [maven-doxia] elharo commented on a diff in pull request #156: [MNG-6825] Replace Plexus IOUtil with IOUtils from commons-io

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #156:
URL: https://github.com/apache/maven-doxia/pull/156#discussion_r1141961961


##########
doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java:
##########
@@ -110,7 +110,7 @@ public final void testTestDocument() throws IOException {
             SinkTestDocument.generate(testSink);
         } finally {
             testSink.close();
-            IOUtil.close(writer);
+            IOUtils.close(writer);

Review Comment:
   https://issues.apache.org/jira/browse/DOXIA-698 but until then this probably works. Does closing the sink close the Writer? If so we don't need IOUtils at all here.
   
   The other pre-existing issue that;s weird in this test is the isXmlSink() branch on line 106. I'm not sure what that's about. 



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