Refine search
public int monthOfYearTextToValue(String text) { Integer month = iParseMonths.get(text); if (month != null) { return month.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.monthOfYear(), text); }
/** * Constructor. * * @param fieldType type of field being set * @param value illegal value being set */ public IllegalFieldValueException(DateTimeFieldType fieldType, String value) { super(createMessage(fieldType.getName(), value)); iDateTimeFieldType = fieldType; iDurationFieldType = null; iFieldName = fieldType.getName(); iStringValue = value; iNumberValue = null; iLowerBound = null; iUpperBound = null; iMessage = super.getMessage(); }
public long set(long instant, int value) { long localInstant = iZone.convertUTCToLocal(instant); localInstant = iField.set(localInstant, value); long result = iZone.convertLocalToUTC(localInstant, false, instant); if (get(result) != value) { IllegalInstantException cause = new IllegalInstantException(localInstant, iZone.getID()); IllegalFieldValueException ex = new IllegalFieldValueException(iField.getType(), Integer.valueOf(value), cause.getMessage()); ex.initCause(cause); throw ex; } return result; }
public int eraTextToValue(String text) { Integer era = iParseEras.get(text); if (era != null) { return era.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.era(), text); }
public int dayOfWeekTextToValue(String text) { Integer day = iParseDaysOfWeek.get(text); if (day != null) { return day.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.dayOfWeek(), text); }
DurationField first = savedFields[0].iField.getDurationField(); if (compareReverse(first, months) >= 0 && compareReverse(first, days) <= 0) { saveField(DateTimeFieldType.year(), iDefaultYear); return computeMillis(resetFields, text); e.prependMessage("Cannot parse \"" + text + '"');
public long set(long instant, int value) { if (instant >= iCutover) { instant = iGregorianField.set(instant, value); if (instant < iCutover) { // Only adjust if gap fully crossed. if (instant + iGapDuration < iCutover) { instant = gregorianToJulian(instant); } // Verify that new value stuck. if (get(instant) != value) { throw new IllegalFieldValueException (iGregorianField.getType(), Integer.valueOf(value), null, null); } } } else { instant = iJulianField.set(instant, value); if (instant >= iCutover) { // Only adjust if gap fully crossed. if (instant - iGapDuration >= iCutover) { instant = julianToGregorian(instant); } // Verify that new value stuck. if (get(instant) != value) { throw new IllegalFieldValueException (iJulianField.getType(), Integer.valueOf(value), null, null); } } } return instant; }
DurationField first = savedFields[0].iField.getDurationField(); if (compareReverse(first, months) >= 0 && compareReverse(first, days) <= 0) { saveField(DateTimeFieldType.year(), iDefaultYear); return computeMillis(resetFields, text); if (!savedFields[i].iField.isLenient()) { millis = savedFields[i].set(millis, i == (count - 1)); e.prependMessage("Cannot parse \"" + text + '"');
static int adjustYearForSet(int year) { if (year <= 0) { if (year == 0) { throw new IllegalFieldValueException (DateTimeFieldType.year(), Integer.valueOf(year), null, null); } year++; } return year; }
int value = values[i]; DateTimeField field = partial.getField(i); if (value < field.getMinimumValue()) { throw new IllegalFieldValueException (field.getType(), Integer.valueOf(value), Integer.valueOf(field.getMinimumValue()), null); if (value > field.getMaximumValue()) { throw new IllegalFieldValueException (field.getType(), Integer.valueOf(value), null, Integer.valueOf(field.getMaximumValue())); DateTimeField field = partial.getField(i); if (value < field.getMinimumValue(partial, values)) { throw new IllegalFieldValueException (field.getType(), Integer.valueOf(value), Integer.valueOf(field.getMinimumValue(partial, values)), null); if (value > field.getMaximumValue(partial, values)) { throw new IllegalFieldValueException (field.getType(), Integer.valueOf(value), null, Integer.valueOf(field.getMaximumValue(partial, values)));
/** * Verify that input values are within specified bounds. * * @param value the value to check * @param lowerBound the lower bound allowed for value * @param upperBound the upper bound allowed for value * @throws IllegalFieldValueException if value is not in the specified bounds */ public static void verifyValueBounds(DateTimeField field, int value, int lowerBound, int upperBound) { if ((value < lowerBound) || (value > upperBound)) { throw new IllegalFieldValueException (field.getType(), Integer.valueOf(value), Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); } }
public int halfdayTextToValue(String text) { String[] halfday = iHalfday; for (int i = halfday.length; --i>=0; ) { if (halfday[i].equalsIgnoreCase(text)) { return i; } } throw new IllegalFieldValueException(DateTimeFieldType.halfdayOfDay(), text); }
/** @inheritDoc */ public long set(long instant, String text, Locale locale) { if (iEraText.equals(text) == false && "1".equals(text) == false) { throw new IllegalFieldValueException(DateTimeFieldType.era(), text); } return instant; }
/** * Constructor. * * @param fieldName name of field being set * @param value illegal value being set */ public IllegalFieldValueException(String fieldName, String value) { super(createMessage(fieldName, value)); iDateTimeFieldType = null; iDurationFieldType = null; iFieldName = fieldName; iStringValue = value; iNumberValue = null; iLowerBound = null; iUpperBound = null; iMessage = super.getMessage(); }
/** * Verify that input values are within specified bounds. * * @param value the value to check * @param lowerBound the lower bound allowed for value * @param upperBound the upper bound allowed for value * @throws IllegalFieldValueException if value is not in the specified bounds */ public static void verifyValueBounds(String fieldName, int value, int lowerBound, int upperBound) { if ((value < lowerBound) || (value > upperBound)) { throw new IllegalFieldValueException (fieldName, Integer.valueOf(value), Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); } }
e.prependMessage("Cannot parse \"" + text + '"');
protected SUTime.Temporal extract(MatchResult results) { try { return tempFunc.apply(results); } catch(org.joda.time.IllegalFieldValueException e) { logger.warning("WARNING: found invalid temporal expression: \"" + e.getMessage() +"\". Will discard it..."); return null; } } }
public int eraTextToValue(String text) { Integer era = iParseEras.get(text); if (era != null) { return era.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.era(), text); }
public int dayOfWeekTextToValue(String text) { Integer day = iParseDaysOfWeek.get(text); if (day != null) { return day.intValue(); } throw new IllegalFieldValueException(DateTimeFieldType.dayOfWeek(), text); }
DurationField first = savedFields[0].iField.getDurationField(); if (compareReverse(first, months) >= 0 && compareReverse(first, days) <= 0) { saveField(DateTimeFieldType.year(), iDefaultYear); return computeMillis(resetFields, text); e.prependMessage("Cannot parse \"" + text + '"');