From: Bryce McKinlay Date: Mon, 19 Feb 2001 03:43:12 +0000 (+0000) Subject: Integer.java (getInteger): Return default argument if property is not set. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d1c8788547414de4fefbec44a1c014b77781fcf;p=gcc.git 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 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9169dd57eac..81cb27fe4a5 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2001-02-19 Bryce McKinlay + + * 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 * java/util/TimerTask.java: New version from Classpath. diff --git a/libjava/java/lang/Integer.java b/libjava/java/lang/Integer.java index 2cf7bb45349..88d0769a275 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 cb2cec2d904..2e812f9696d 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()