diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 2001-02-19 03:43:12 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2001-02-19 03:43:12 +0000 |
commit | 3d1c8788547414de4fefbec44a1c014b77781fcf (patch) | |
tree | 5eb1c70ca3de54759110b7931c0bd84751cf10f2 /libjava | |
parent | 8d444206b1acc6ac375c10cc82f0223ab2f05d98 (diff) | |
download | gcc-3d1c8788547414de4fefbec44a1c014b77781fcf.zip gcc-3d1c8788547414de4fefbec44a1c014b77781fcf.tar.gz gcc-3d1c8788547414de4fefbec44a1c014b77781fcf.tar.bz2 |
Integer.java (getInteger): Return default argument if property is not set.
* 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
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/java/lang/Integer.java | 14 | ||||
-rw-r--r-- | libjava/java/lang/Long.java | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9169dd5..81cb27f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/java/lang/Integer.java b/libjava/java/lang/Integer.java index 2cf7bb4..88d0769 100644 --- a/libjava/java/lang/Integer.java +++ b/libjava/java/lang/Integer.java @@ -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() diff --git a/libjava/java/lang/Long.java b/libjava/java/lang/Long.java index cb2cec2..2e812f9 100644 --- a/libjava/java/lang/Long.java +++ b/libjava/java/lang/Long.java @@ -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() |