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
This commit is contained in:
Bryce McKinlay 2001-02-19 03:43:12 +00:00 committed by Bryce McKinlay
parent 8d444206b1
commit 3d1c878854
3 changed files with 22 additions and 12 deletions

View 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> 2001-02-17 Mark Wielaard <mark@klomp.org>
* java/util/TimerTask.java: New version from Classpath. * java/util/TimerTask.java: New version from Classpath.

View File

@ -156,12 +156,14 @@ public final class Integer extends Number implements Comparable
{ {
try try
{ {
return decode(System.getProperty(prop)); String val = System.getProperty(prop);
if (val != null)
return decode(val);
} }
catch (NumberFormatException ex) catch (NumberFormatException ex)
{ {
return defobj;
} }
return defobj;
} }
public int hashCode() public int hashCode()

View File

@ -157,12 +157,14 @@ public final class Long extends Number implements Comparable
{ {
try try
{ {
return decode(System.getProperty(prop)); String val = System.getProperty(prop);
if (val != null)
return decode(val);
} }
catch (NumberFormatException ex) catch (NumberFormatException ex)
{ {
return defobj;
} }
return defobj;
} }
public int hashCode() public int hashCode()