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/java/lang/Long.java | |
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/java/lang/Long.java')
-rw-r--r-- | libjava/java/lang/Long.java | 14 |
1 files changed, 8 insertions, 6 deletions
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() |