[8] Review Request for 8007292 : Add JavaFX internal packages to package.access
David Holmes
david.holmes at oracle.com
Thu Oct 10 01:18:21 UTC 2013
cc'ing Joe Darcy. :)
Joe: there is a try-with-resources question for you below ...
On 9/10/2013 11:20 PM, Sean Mullan wrote:
> On 10/09/2013 05:14 AM, Erik Joelsson wrote:
>> On 2013-10-09 06:33, David Holmes wrote:
>>> In the tool this code doesn't show correct use of try-with-resources:
>>>
>>> 51 try (BufferedReader br = new BufferedReader(new
>>> FileReader(args[0]));
>>> 52 BufferedWriter bw = new BufferedWriter(new
>>> FileWriter(args[1]))) {
>>>
>>> The FileReader and FileWriter should also be covered by TWR:
>>>
>>> try (FileReader fr = new FileReader(args[0]);
>>> BufferedReader br = new BufferedReader(fr);
>>> FileWriter fw = new FileWriter(args[1]);
>>> BufferedWriter bw = new BufferedWriter(fw)) {
>>>
>> I'm not familiar with the try-with-resources, but calling close on a
>> BufferedReader/writer will close the underlying reader/writer so nothing
>> will be left open, will it not?
>
> That's what I thought as well. David?
It maybe that I am overly pedantic with this but the issue is that with
the original code if the BufferedReader/Writer constructors throw an
exception then the FileReader/Writer that was already created would not
be closed. The revised code accounts for this.
Joe: what is best-practice here? I see a lot of examples of t-w-r where
there is a set of chained I/O streams and only the outermost one is a
t-w-r resource. And that seems wrong to me.
Thanks,
David
>>> Finally do we still use make/tools/Makefile in the new build?
>>>
>> No, we don't. If you want to add old build support for this, you would
>> also need to add usage of the tool to the correct old makefile.
>
> I don't think it's necessary to add this to the old build at this point.
>
> I'll post another webrev later in the day with these updates.
>
> Thanks,
> Sean
>
More information about the security-dev
mailing list