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)
     */

Reply via email to