src/java.base/share/classes/java/time/Duration.java
Print this page
rev 10594 : 8055251: Re-examine Integer.parseInt and Long.parseLong methods
@@ -422,11 +422,11 @@
// regex limits to [-+]?[0-9]+
if (start < 0 || end < 0) {
return 0;
}
try {
- long val = Long.parseLong(text, 10, start, end);
+ long val = Long.parseLong(text, start, end, 10);
return Math.multiplyExact(val, multiplier);
} catch (NumberFormatException | ArithmeticException ex) {
throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: " + errorText, text, 0).initCause(ex);
}
}
@@ -435,11 +435,11 @@
// regex limits to [0-9]{0,9}
if (start < 0 || end < 0 || end - start == 0) {
return 0;
}
try {
- int fraction = Integer.parseInt(text, 10, start, end);
+ int fraction = Integer.parseInt(text, start, end, 10);
// for number strings smaller than 9 digits, interpret as if there
// were trailing zeros
for (int i = end - start; i < 9; i++) {
fraction *= 10;