RFR 9: 8048124 Read hijrah-config-umalqura.properties as a resource
roger riggs
roger.riggs at oracle.com
Mon Oct 20 19:11:20 UTC 2014
Hi,
Updated with recommendations to make the code more readable and
to use the more appropriate Integer.parseInt instead of valueOf.
Webrev:
http://cr.openjdk.java.net/~rriggs/webrev-hijrah-config-8049376/
Issue:
https://bugs.openjdk.java.net/browse/JDK-8048124
Roger
On 10/20/2014 2:53 PM, Alan Bateman wrote:
> On 20/10/2014 19:17, roger riggs wrote:
>> Hi,
>>
>> Updated with recommendations.
>>
>> Webrev:
>> http://cr.openjdk.java.net/~rriggs/webrev-hijrah-config-8049376/
>> Issue:
>> https://bugs.openjdk.java.net/browse/JDK-8048124
>>
> "<<ALL FILES>>" seems excessive when I think you only need
> ${java.home}/- but still better than all.
yes, reading the java.home property required a doPriv and then a nested
doPriv with
the properly constructed FilePermission. The code was getting unwieldy.
>
> A minor comment is that expression for the try-with-resources uses
> AccessController with parameters over 4 lines isn't easy to read. It
> might be a bit clearer with multiple statements, as in:
>
> PrivilegedAction<InputStream> action = () -> HijrahChronology
> .class.getResourceAsStream(resourceName);
> Permission permission = new FilePermission("<<ALL FILES>>", "read");
> try (InputStream in = AccessController.doPrivileged(action, null,
> permission)) {
> :
> }
Yes, easier to read and parse.
Thanks, Roger
More information about the core-libs-dev
mailing list