Package org.threeten.bp

Examples of org.threeten.bp.DateTimeException


        if (type == null || "iso".equals(type) || "iso8601".equals(type)) {
            return IsoChronology.INSTANCE;
        } else {
            Chronology chrono = CHRONOS_BY_TYPE.get(type);
            if (chrono == null) {
                throw new DateTimeException("Unknown calendar system: " + type);
            }
            return chrono;
        }
    }
View Full Code Here


        }
        chrono = CHRONOS_BY_TYPE.get(id);
        if (chrono != null) {
            return chrono;
        }
        throw new DateTimeException("Unknown chronology: " + id);
    }
View Full Code Here

    public ChronoLocalDateTime<?> localDateTime(TemporalAccessor temporal) {
        try {
            ChronoLocalDate date = date(temporal);
            return date.atTime(LocalTime.from(temporal));
        } catch (DateTimeException ex) {
            throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass(), ex);
        }
    }
View Full Code Here

                ChronoLocalDateTime cldt = localDateTime(temporal);
                ChronoLocalDateTimeImpl cldtImpl = ensureChronoLocalDateTime(cldt);
                return ChronoZonedDateTimeImpl.ofBest(cldtImpl, zone, null);
            }
        } catch (DateTimeException ex) {
            throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass(), ex);
        }
    }
View Full Code Here

     * @throws DateTimeException if a conflict occurs
     */
    void updateResolveMap(Map<TemporalField, Long> fieldValues, ChronoField field, long value) {
        Long current = fieldValues.get(field);
        if (current != null && current.longValue() != value) {
            throw new DateTimeException("Invalid state, field: " + field + " " + current + " conflicts with " + field + " " + value);
        }
        fieldValues.put(field, value);
    }
View Full Code Here

        if (temporal instanceof ChronoLocalDateTime) {
            return (ChronoLocalDateTime<?>) temporal;
        }
        Chronology chrono = temporal.query(TemporalQueries.chronology());
        if (chrono == null) {
            throw new DateTimeException("No Chronology found to create ChronoLocalDateTime: " + temporal.getClass());
        }
        return chrono.localDateTime(temporal);
    }
View Full Code Here

                        Jdk8Methods.safeAdd(years, amount.years),
                        Jdk8Methods.safeAdd(months, amount.months),
                        Jdk8Methods.safeAdd(days, amount.days));
            }
        }
        throw new DateTimeException("Unable to add amount: " + amountToAdd);
    }
View Full Code Here

                        Jdk8Methods.safeSubtract(years, amount.years),
                        Jdk8Methods.safeSubtract(months, amount.months),
                        Jdk8Methods.safeSubtract(days, amount.days));
            }
        }
        throw new DateTimeException("Unable to subtract amount: " + amountToSubtract);
    }
View Full Code Here

    @Override
    public Temporal addTo(Temporal temporal) {
        Jdk8Methods.requireNonNull(temporal, "temporal");
        Chronology temporalChrono = temporal.query(TemporalQueries.chronology());
        if (temporalChrono != null && chronology.equals(temporalChrono) == false) {
            throw new DateTimeException("Invalid chronology, required: " + chronology.getId() + ", but was: " + temporalChrono.getId());
        }
        if (years != 0) {
            temporal = temporal.plus(years, YEARS);
        }
        if (months != 0) {
View Full Code Here

    @Override
    public Temporal subtractFrom(Temporal temporal) {
        Jdk8Methods.requireNonNull(temporal, "temporal");
        Chronology temporalChrono = temporal.query(TemporalQueries.chronology());
        if (temporalChrono != null && chronology.equals(temporalChrono) == false) {
            throw new DateTimeException("Invalid chronology, required: " + chronology.getId() + ", but was: " + temporalChrono.getId());
        }
        if (years != 0) {
            temporal = temporal.minus(years, YEARS);
        }
        if (months != 0) {
View Full Code Here

TOP

Related Classes of org.threeten.bp.DateTimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.