Code Review 7000511: PrintStream, PrintWriter, Formatter leave files open when exception thrown
Chris Hegarty
chris.hegarty at oracle.com
Wed Dec 15 21:03:19 UTC 2010
On 12/14/10 06:03 PM, Alan Bateman wrote:
> .....
> It would be good to get this one fixed. If I understand the proposal
> correctly, there may still be side effects when NPE or
> UnsupportedEncodingException is thrown. When I say "side effects" I mean
> that an empty file may be created or an existing file truncated before
> the exception is thrown. I wonder you've tried to extend the list of
> parameters to the private constructors to avoid this. A
> toCharset(String) method should be used to lookup the Charset for
> example rather than having OutputStreamWriter to do it.
>
> One minor comment is that I see that PrintStream is using
> java.util.Objects. Nice to see it being used but I wonder about loading
> yet another class during startup (System.out and err are PrintStreams
> and are initialized early in the startup).
Thanks for your comments Alan. I reworked the changes to include them.
Updated webrev:
http://cr.openjdk.java.net/~chegar/7000511/webrev.01/webrev/
-Chris.
>
> -Alan
More information about the core-libs-dev
mailing list