Integer.java (getInteger): Return default argument if property is not set.
authorBryce McKinlay <bryce@albatross.co.nz>
Mon, 19 Feb 2001 03:43:12 +0000 (03:43 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 19 Feb 2001 03:43:12 +0000 (03:43 +0000)
* java/lang/Integer.java (getInteger): Return default argument if
property is not set. Don't call decode with null argument.
* java/lang/Long.java (getLong): Likewise.

From-SVN: r39870

libjava/ChangeLog
libjava/java/lang/Integer.java
libjava/java/lang/Long.java

index 9169dd57eac4d61c17d0f4718fc90e9592580af6..81cb27fe4a561488e59eefface59e50f5e08d404 100644 (file)
@@ -1,3 +1,9 @@
+2001-02-19  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * java/lang/Integer.java (getInteger): Return default argument if
+       property is not set. Don't call decode with null argument.
+       * java/lang/Long.java (getLong): Likewise.
+
 2001-02-17  Mark Wielaard <mark@klomp.org>
 
        * java/util/TimerTask.java: New version from Classpath.
index 2cf7bb453495334b896245c20dce534270e11fc8..88d0769a275c0f982bb35a812508f62ab19cd672 100644 (file)
@@ -155,13 +155,15 @@ public final class Integer extends Number implements Comparable
   public static Integer getInteger(String prop, Integer defobj)
   {
     try
-    {
-      return decode(System.getProperty(prop));
-    }
+      {
+        String val = System.getProperty(prop);
+       if (val != null)
+         return decode(val);
+      }
     catch (NumberFormatException ex)
-    {
-      return defobj;
-    }
+      {
+      }
+    return defobj;
   }
 
   public int hashCode()
index cb2cec2d904404fc62def369e163d56632110a9f..2e812f9696d8bf245d21247c3a229387685aaf97 100644 (file)
@@ -156,13 +156,15 @@ public final class Long extends Number implements Comparable
   public static Long getLong(String prop, Long defobj)
   {
     try
-    {
-      return decode(System.getProperty(prop));
-    }
+      {
+        String val = System.getProperty(prop);
+       if (val != null)    
+         return decode(val);
+      }
     catch (NumberFormatException ex)
-    {
-      return defobj;
-    }
+      {
+      }
+    return defobj;
   }
 
   public int hashCode()