src/share/classes/java/lang/Long.java
Print this page
*** 508,518 ****
* radix.
* @throws NumberFormatException If the {@code String} does not
* contain a parsable {@code long}.
*/
public static Long valueOf(String s, int radix) throws NumberFormatException {
! return new Long(parseLong(s, radix));
}
/**
* Returns a {@code Long} object holding the value
* of the specified {@code String}. The argument is
--- 508,518 ----
* radix.
* @throws NumberFormatException If the {@code String} does not
* contain a parsable {@code long}.
*/
public static Long valueOf(String s, int radix) throws NumberFormatException {
! return Long.valueOf(parseLong(s, radix));
}
/**
* Returns a {@code Long} object holding the value
* of the specified {@code String}. The argument is
*** 535,545 ****
* @throws NumberFormatException If the string cannot be parsed
* as a {@code long}.
*/
public static Long valueOf(String s) throws NumberFormatException
{
! return new Long(parseLong(s, 10));
}
private static class LongCache {
private LongCache(){}
--- 535,545 ----
* @throws NumberFormatException If the string cannot be parsed
* as a {@code long}.
*/
public static Long valueOf(String s) throws NumberFormatException
{
! return Long.valueOf(parseLong(s, 10));
}
private static class LongCache {
private LongCache(){}
*** 648,658 ****
if (nm.startsWith("-", index) || nm.startsWith("+", index))
throw new NumberFormatException("Sign character in wrong position");
try {
result = Long.valueOf(nm.substring(index), radix);
! result = negative ? new Long(-result.longValue()) : result;
} catch (NumberFormatException e) {
// If number is Long.MIN_VALUE, we'll end up here. The next line
// handles this case, and causes any genuine format error to be
// rethrown.
String constant = negative ? ("-" + nm.substring(index))
--- 648,658 ----
if (nm.startsWith("-", index) || nm.startsWith("+", index))
throw new NumberFormatException("Sign character in wrong position");
try {
result = Long.valueOf(nm.substring(index), radix);
! result = negative ? Long.valueOf(-result.longValue()) : result;
} catch (NumberFormatException e) {
// If number is Long.MIN_VALUE, we'll end up here. The next line
// handles this case, and causes any genuine format error to be
// rethrown.
String constant = negative ? ("-" + nm.substring(index))
*** 867,877 ****
* @see java.lang.System#getProperty(java.lang.String)
* @see java.lang.System#getProperty(java.lang.String, java.lang.String)
*/
public static Long getLong(String nm, long val) {
Long result = Long.getLong(nm, null);
! return (result == null) ? new Long(val) : result;
}
/**
* Returns the {@code long} value of the system property with
* the specified name. The first argument is treated as the name
--- 867,877 ----
* @see java.lang.System#getProperty(java.lang.String)
* @see java.lang.System#getProperty(java.lang.String, java.lang.String)
*/
public static Long getLong(String nm, long val) {
Long result = Long.getLong(nm, null);
! return (result == null) ? Long.valueOf(val) : result;
}
/**
* Returns the {@code long} value of the system property with
* the specified name. The first argument is treated as the name