JDK 8 code review request for 6268216 "Boolean.getBoolean() throws SecurityException"
Joe Darcy
joe.darcy at oracle.com
Wed Sep 21 00:54:58 UTC 2011
Mike Duigou wrote:
> Looks good.
>
> Do you think it's worth eliminating the private static method toBoolean(String) in favour of the public static parseBoolean(String) method?
>
Sure; so updated in the revised webrev:
http://cr.openjdk.java.net/~darcy/6268216.1/
I'll push after a successful sanity build+test cycle.
Thanks,
-Joe
> Mike
>
>
>
> On Sep 20 2011, at 16:46 , Joe Darcy wrote:
>
>
>> Hello.
>>
>> Please review this simple fix to add some informative text detailing when an unchecked security exception can be thrown:
>>
>> 6268216 "Boolean.getBoolean() throws SecurityException"
>> http://cr.openjdk.java.net/~darcy/6268216.0/
>>
>> Diff below.
>>
>> Thanks,
>>
>> -Joe
>>
>> --- old/src/share/classes/java/lang/Boolean.java 2011-09-20 16:43:18.000000000 -0700
>> +++ new/src/share/classes/java/lang/Boolean.java 2011-09-20 16:43:17.000000000 -0700
>> @@ -229,6 +229,8 @@
>> *
>> * @param name the system property name.
>> * @return the {@code boolean} value of the system property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see java.lang.System#getProperty(java.lang.String)
>> * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
>> */
>> @@ -236,8 +238,7 @@
>> boolean result = false;
>> try {
>> result = toBoolean(System.getProperty(name));
>> - } catch (IllegalArgumentException e) {
>> - } catch (NullPointerException e) {
>> + } catch (IllegalArgumentException | NullPointerException e) {
>> }
>> return result;
>> }
>> --- old/src/share/classes/java/lang/Integer.java 2011-09-20 16:43:18.000000000 -0700
>> +++ new/src/share/classes/java/lang/Integer.java 2011-09-20 16:43:18.000000000 -0700
>> @@ -797,6 +797,8 @@
>> *
>> * @param nm property name.
>> * @return the {@code Integer} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see java.lang.System#getProperty(java.lang.String)
>> * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
>> */
>> @@ -841,6 +843,8 @@
>> * @param nm property name.
>> * @param val default value.
>> * @return the {@code Integer} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see java.lang.System#getProperty(java.lang.String)
>> * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
>> */
>> @@ -881,6 +885,8 @@
>> * @param nm property name.
>> * @param val default value.
>> * @return the {@code Integer} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see System#getProperty(java.lang.String)
>> * @see System#getProperty(java.lang.String, java.lang.String)
>> */
>> --- old/src/share/classes/java/lang/Long.java 2011-09-20 16:43:19.000000000 -0700
>> +++ new/src/share/classes/java/lang/Long.java 2011-09-20 16:43:19.000000000 -0700
>> @@ -827,6 +827,8 @@
>> *
>> * @param nm property name.
>> * @return the {@code Long} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see java.lang.System#getProperty(java.lang.String)
>> * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
>> */
>> @@ -870,6 +872,8 @@
>> * @param nm property name.
>> * @param val default value.
>> * @return the {@code Long} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see java.lang.System#getProperty(java.lang.String)
>> * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
>> */
>> @@ -917,6 +921,8 @@
>> * @param nm property name.
>> * @param val default value.
>> * @return the {@code Long} value of the property.
>> + * @throws SecurityException for the same reasons as
>> + * {@link System#getProperty(String) System.getProperty}
>> * @see System#getProperty(java.lang.String)
>> * @see System#getProperty(java.lang.String, java.lang.String)
>> */
>>
>>
>
>
More information about the core-libs-dev
mailing list