This exception includes the text being parsed and the error index. @implSpec This class is intended for use in a single thread. @since 1.8
This exception includes the text being parsed and the error index.
341342343344345346347348349350351
int weeks = parseNumber(text, weekMatch, negate); int days = parseNumber(text, dayMatch, negate); days = Math.addExact(days, Math.multiplyExact(weeks, 7)); return create(years, months, days); } catch (NumberFormatException ex) { throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex); } } } throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0); }
356357358359360361362363
} int val = Integer.parseInt(str); try { return Math.multiplyExact(val, negate); } catch (ArithmeticException ex) { throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex); } }
419420421422423424425426
} try { long val = Long.parseLong(parsed); 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); } }
432433434435436437438439
} try { parsed = (parsed + "000000000").substring(0, 9); return Integer.parseInt(parsed) * negate; } catch (NumberFormatException | ArithmeticException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: fraction", text, 0).initCause(ex); } }
412413414415416417418419420421422423
boolean negativeSecs = secondMatch != null && secondMatch.charAt(0) == '-'; int nanos = parseFraction(text, fractionMatch, negativeSecs ? -1 : 1); try { return create(negate, daysAsSecs, hoursAsSecs, minsAsSecs, seconds, nanos); } catch (ArithmeticException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: overflow", text, 0).initCause(ex); } } } } throw new DateTimeParseException("Text cannot be parsed to a Duration", text, 0); }
432433434435436437438439440441
parsed = parsed.substring(1); } long val = Long.parseLong(parsed); return Jdk8Methods.safeMultiply(val, multiplier); } catch (NumberFormatException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: " + errorText, text, 0).initCause(ex); } catch (ArithmeticException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: " + errorText, text, 0).initCause(ex); } }
447448449450451452453454455456
} try { parsed = (parsed + "000000000").substring(0, 9); return Integer.parseInt(parsed) * negate; } catch (NumberFormatException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: fraction", text, 0).initCause(ex); } catch (ArithmeticException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Duration: fraction", text, 0).initCause(ex); } }
315316317318319320321322323324325
int weeks = parseNumber(text, weekMatch, negate); int days = parseNumber(text, dayMatch, negate); days = Jdk8Methods.safeAdd(days, Jdk8Methods.safeMultiply(weeks, 7)); return create(years, months, days); } catch (NumberFormatException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex); } } } throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0); }
330331332333334335336337
} int val = Integer.parseInt(str); try { return Jdk8Methods.safeMultiply(val, negate); } catch (ArithmeticException ex) { throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex); } }