类org.joda.time.IllegalFieldValueException源码实例Demo

下面列出了怎么用org.joda.time.IllegalFieldValueException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: SimFix   文件: 1_SkipDateTimeField.java
public long set(long millis, int value) {
        FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue());
// start of generated patch
if(value<=iSkip){
if(value==iSkip){
throw new IllegalFieldValueException(DateTimeFieldType.year(),Integer.valueOf(value),null,null);
}
getMaximumValue();
}
// end of generated patch
/* start of original code
        if (value <= iSkip) {
            if (value == iSkip) {
                throw new IllegalFieldValueException
                    (DateTimeFieldType.year(), Integer.valueOf(value), null, null);
            }
            value++;
        }
 end of original code*/
        return super.set(millis, value);
    }
 
源代码2 项目: AndroidAPS   文件: MedtronicConverter.java
private LocalDateTime decodeTime(byte[] rawContent) {

        int hours = ByteUtil.asUINT8(rawContent[0]);
        int minutes = ByteUtil.asUINT8(rawContent[1]);
        int seconds = ByteUtil.asUINT8(rawContent[2]);
        int year = (ByteUtil.asUINT8(rawContent[4]) & 0x3f) + 1984;
        int month = ByteUtil.asUINT8(rawContent[5]);
        int day = ByteUtil.asUINT8(rawContent[6]);
        try {
            LocalDateTime pumpTime = new LocalDateTime(year, month, day, hours, minutes, seconds);
            return pumpTime;
        } catch (IllegalFieldValueException e) {
            LOG.error(
                    "decodeTime: Failed to parse pump time value: year=%d, month=%d, hours=%d, minutes=%d, seconds=%d",
                    year, month, day, hours, minutes, seconds);
            return null;
        }

    }
 
@Override
public long set(long instant, int value) {
  // Check for illegal values: this is not a lenient field
  if (value < 1 || value > this.numMonthsInYear) {
    throw new IllegalFieldValueException(this.getType(), value, 1, this.numMonthsInYear);
  }
  // What is the current month?
  int monthOfYear = this.get(instant);
  // How many months do we have to add to arrive at the new value
  int monthsToAdd = value - monthOfYear;
  // Now add the required number of months
  return this.add(instant, monthsToAdd);
}
 
源代码4 项目: ibm-cos-sdk-java   文件: DateUtilsTest.java
@Test(expected=IllegalFieldValueException.class)
public void testIssue233JodaTimeLimit() throws ParseException {
    // https://github.com/aws/aws-sdk-java/issues/233
    String s = DateUtils.iso8601DateFormat.print(Long.MAX_VALUE);
    System.out.println("s: " + s);
    try {
        DateTime dt = DateUtils.iso8601DateFormat.parseDateTime(s);
        fail("Unexpected success: " + dt);
    } catch(IllegalFieldValueException ex) {
        // expected
        throw ex;
    }
}
 
@Override
public void serialize(Long timestamp, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
  // Joda may throw an exception if the timestamp is MAX_LONG so protect ourselves here.
  try {
    DateTime dateTime = new DateTime(timestamp).withZone(DateTimeZone.UTC);
    jsonGenerator.writeObject(dateTime.toString(ISODateTimeFormat.dateTime()));
  } catch (IllegalFieldValueException e) {
    jsonGenerator.writeString("ERROR");
  }
}
 
源代码6 项目: coming   文件: Arja_0050_t.java
/**
 * 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));
    }
}
 
源代码7 项目: coming   文件: Arja_0050_t.java
/**
 * 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));
    }
}
 
源代码8 项目: coming   文件: Arja_0050_s.java
/**
 * 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));
    }
}
 
源代码9 项目: coming   文件: Arja_0050_s.java
/**
 * 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));
    }
}
 
源代码10 项目: coming   文件: Elixir_0039_t.java
/**
 * 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));
    }
}
 
源代码11 项目: coming   文件: Elixir_0039_t.java
/**
 * 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));
    }
}
 
源代码12 项目: coming   文件: Elixir_0039_s.java
/**
 * 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));
    }
}
 
源代码13 项目: coming   文件: Elixir_0039_s.java
/**
 * 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));
    }
}
 
源代码14 项目: coming   文件: elixir3_three_t.java
/**
 * 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));
    }
}
 
源代码15 项目: coming   文件: elixir3_three_t.java
/**
 * 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));
    }
}
 
源代码16 项目: coming   文件: elixir3_three_s.java
/**
 * 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));
    }
}
 
源代码17 项目: coming   文件: elixir3_three_s.java
/**
 * 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));
    }
}
 
源代码18 项目: coming   文件: Time_18_GJChronology_t.java
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;
}
 
源代码19 项目: coming   文件: Time_18_GJChronology_s.java
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;
}
 
源代码20 项目: coming   文件: Time_15_FieldUtils_s.java
/**
 * 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));
    }
}
 
源代码21 项目: coming   文件: Time_15_FieldUtils_s.java
/**
 * 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));
    }
}
 
源代码22 项目: coming   文件: Time_15_FieldUtils_t.java
/**
 * 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));
    }
}
 
源代码23 项目: coming   文件: Time_15_FieldUtils_t.java
/**
 * 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));
    }
}
 
源代码24 项目: coming   文件: Time_6_GJChronology_s.java
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;
}
 
源代码25 项目: coming   文件: Time_6_GJChronology_t.java
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;
}
 
源代码26 项目: coming   文件: Time_26_ZonedChronology_t.java
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) {
        throw new IllegalFieldValueException(iField.getType(), new Integer(value),
            "Illegal instant due to time zone offset transition: " +
            DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS").print(new Instant(localInstant)) +
            " (" + iZone.getID() + ")");
    }
    return result;
}
 
源代码27 项目: coming   文件: Time_26_ZonedChronology_s.java
public long set(long instant, int value) {
    long localInstant = iZone.convertUTCToLocal(instant);
    localInstant = iField.set(localInstant, value);
    long result = iZone.convertLocalToUTC(localInstant, false);
    if (get(result) != value) {
        throw new IllegalFieldValueException(iField.getType(), new Integer(value),
            "Illegal instant due to time zone offset transition: " +
            DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS").print(new Instant(localInstant)) +
            " (" + iZone.getID() + ")");
    }
    return result;
}
 
源代码28 项目: astor   文件: FieldUtils.java
/**
 * 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));
    }
}
 
源代码29 项目: astor   文件: FieldUtils.java
/**
 * 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));
    }
}
 
源代码30 项目: astor   文件: SkipDateTimeField.java
public long set(long millis, int value) {
    FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue());
    if (value <= iSkip) {
        if (value == iSkip) {
            throw new IllegalFieldValueException
                (DateTimeFieldType.year(), Integer.valueOf(value), null, null);
        }
        value++;
    }
    return super.set(millis, value);
}
 
 类所在包
 同包方法