maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChristianSchulte <...@git.apache.org>
Subject [GitHub] maven-surefire pull request #144: Resource leaks.
Date Sun, 26 Feb 2017 17:08:49 GMT
Github user ChristianSchulte commented on a diff in the pull request:

    https://github.com/apache/maven-surefire/pull/144#discussion_r103110250
  
    --- Diff: surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
---
    @@ -236,13 +236,17 @@ private static void exit( int returnCode, Shutdown shutdownType,
CommandReader r
             switch ( shutdownType )
             {
                 case KILL:
    +                System.out.close();
    --- End diff --
    
    `System.in` and `System.out` are both [`PrintStream`](http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/8108ffe38ccb/src/share/classes/java/io/PrintStream.java)s.
That class already is error prone like mad (autoFlush yes or no, checkError instead of throwing
exceptions, etc.). It internally creates a `BufferedWriter` used for writing characters. I
haven't found anything in the JDK flushing those buffers so it seems this is up to the application.
I am quite sure that closing those streams manually is correct. That's what you would do in
a C application as well.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message