changeset 4532:6e9ed747d0ca

4850225: Integer.getInteger() : Bad reference to getProperty? Reviewed-by: lancea
author darcy
date Mon, 15 Aug 2011 12:56:01 -0700
parents b07cf6cbb62a
children afb6f2370cd3
files src/share/classes/java/lang/Integer.java src/share/classes/java/lang/Long.java
diffstat 2 files changed, 38 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/Integer.java	Mon Aug 15 00:30:35 2011 -0700
+++ b/src/share/classes/java/lang/Integer.java	Mon Aug 15 12:56:01 2011 -0700
@@ -776,17 +776,17 @@
      * Determines the integer value of the system property with the
      * specified name.
      *
-     * <p>The first argument is treated as the name of a system property.
-     * System properties are accessible through the
-     * {@link java.lang.System#getProperty(java.lang.String)} method. The
+     * <p>The first argument is treated as the name of a system
+     * property.  System properties are accessible through the {@link
+     * java.lang.System#getProperty(java.lang.String)} method. The
      * string value of this property is then interpreted as an integer
-     * value and an {@code Integer} object representing this value is
-     * returned. Details of possible numeric formats can be found with
-     * the definition of {@code getProperty}.
+     * value using the grammar supported by {@link Integer#decode decode} and
+     * an {@code Integer} object representing this value is returned.
      *
-     * <p>If there is no property with the specified name, if the specified name
-     * is empty or {@code null}, or if the property does not have
-     * the correct numeric format, then {@code null} is returned.
+     * <p>If there is no property with the specified name, if the
+     * specified name is empty or {@code null}, or if the property
+     * does not have the correct numeric format, then {@code null} is
+     * returned.
      *
      * <p>In other words, this method returns an {@code Integer}
      * object equal to the value of:
@@ -808,13 +808,12 @@
      * Determines the integer value of the system property with the
      * specified name.
      *
-     * <p>The first argument is treated as the name of a system property.
-     * System properties are accessible through the {@link
+     * <p>The first argument is treated as the name of a system
+     * property.  System properties are accessible through the {@link
      * java.lang.System#getProperty(java.lang.String)} method. The
      * string value of this property is then interpreted as an integer
-     * value and an {@code Integer} object representing this value is
-     * returned. Details of possible numeric formats can be found with
-     * the definition of {@code getProperty}.
+     * value using the grammar supported by {@link Integer#decode decode} and
+     * an {@code Integer} object representing this value is returned.
      *
      * <p>The second argument is the default value. An {@code Integer} object
      * that represents the value of the second argument is returned if there
@@ -856,9 +855,9 @@
      * system property.  System properties are accessible through the
      * {@link java.lang.System#getProperty(java.lang.String)} method.
      * The string value of this property is then interpreted as an
-     * integer value, as per the {@code Integer.decode} method,
+     * integer value, as per the {@link Integer#decode decode} method,
      * and an {@code Integer} object representing this value is
-     * returned.
+     * returned; in summary:
      *
      * <ul><li>If the property value begins with the two ASCII characters
      *         {@code 0x} or the ASCII character {@code #}, not
@@ -882,16 +881,14 @@
      * @param   nm   property name.
      * @param   val   default value.
      * @return  the {@code Integer} value of the property.
-     * @see     java.lang.System#getProperty(java.lang.String)
-     * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
-     * @see java.lang.Integer#decode
+     * @see     System#getProperty(java.lang.String)
+     * @see     System#getProperty(java.lang.String, java.lang.String)
      */
     public static Integer getInteger(String nm, Integer val) {
         String v = null;
         try {
             v = System.getProperty(nm);
-        } catch (IllegalArgumentException e) {
-        } catch (NullPointerException e) {
+        } catch (IllegalArgumentException | NullPointerException e) {
         }
         if (v != null) {
             try {
--- a/src/share/classes/java/lang/Long.java	Mon Aug 15 00:30:35 2011 -0700
+++ b/src/share/classes/java/lang/Long.java	Mon Aug 15 12:56:01 2011 -0700
@@ -806,22 +806,20 @@
      * Determines the {@code long} value of the system property
      * with the specified name.
      *
-     * <p>The first argument is treated as the name of a system property.
-     * System properties are accessible through the {@link
+     * <p>The first argument is treated as the name of a system
+     * property.  System properties are accessible through the {@link
      * java.lang.System#getProperty(java.lang.String)} method. The
-     * string value of this property is then interpreted as a
-     * {@code long} value and a {@code Long} object
-     * representing this value is returned.  Details of possible
-     * numeric formats can be found with the definition of
-     * {@code getProperty}.
+     * string value of this property is then interpreted as a {@code
+     * long} value using the grammar supported by {@link Long#decode decode}
+     * and a {@code Long} object representing this value is returned.
      *
      * <p>If there is no property with the specified name, if the
-     * specified name is empty or {@code null}, or if the
-     * property does not have the correct numeric format, then
-     * {@code null} is returned.
+     * specified name is empty or {@code null}, or if the property
+     * does not have the correct numeric format, then {@code null} is
+     * returned.
      *
-     * <p>In other words, this method returns a {@code Long} object equal to
-     * the value of:
+     * <p>In other words, this method returns a {@code Long} object
+     * equal to the value of:
      *
      * <blockquote>
      *  {@code getLong(nm, null)}
@@ -840,14 +838,12 @@
      * Determines the {@code long} value of the system property
      * with the specified name.
      *
-     * <p>The first argument is treated as the name of a system property.
-     * System properties are accessible through the {@link
+     * <p>The first argument is treated as the name of a system
+     * property.  System properties are accessible through the {@link
      * java.lang.System#getProperty(java.lang.String)} method. The
-     * string value of this property is then interpreted as a
-     * {@code long} value and a {@code Long} object
-     * representing this value is returned.  Details of possible
-     * numeric formats can be found with the definition of
-     * {@code getProperty}.
+     * string value of this property is then interpreted as a {@code
+     * long} value using the grammar supported by {@link Long#decode decode}
+     * and a {@code Long} object representing this value is returned.
      *
      * <p>The second argument is the default value. A {@code Long} object
      * that represents the value of the second argument is returned if there
@@ -889,8 +885,8 @@
      * the {@link java.lang.System#getProperty(java.lang.String)}
      * method. The string value of this property is then interpreted
      * as a {@code long} value, as per the
-     * {@code Long.decode} method, and a {@code Long} object
-     * representing this value is returned.
+     * {@link Long#decode decode} method, and a {@code Long} object
+     * representing this value is returned; in summary:
      *
      * <ul>
      * <li>If the property value begins with the two ASCII characters
@@ -921,16 +917,14 @@
      * @param   nm   property name.
      * @param   val   default value.
      * @return  the {@code Long} value of the property.
-     * @see     java.lang.System#getProperty(java.lang.String)
-     * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
-     * @see java.lang.Long#decode
+     * @see     System#getProperty(java.lang.String)
+     * @see     System#getProperty(java.lang.String, java.lang.String)
      */
     public static Long getLong(String nm, Long val) {
         String v = null;
         try {
             v = System.getProperty(nm);
-        } catch (IllegalArgumentException e) {
-        } catch (NullPointerException e) {
+        } catch (IllegalArgumentException | NullPointerException e) {
         }
         if (v != null) {
             try {