Java 类java.util.IllegalFormatWidthException 实例源码

项目:form-follows-function    文件:F3Formatter.java   
private void checkNumeric() {
    if (width != -1 && width < 0)
        throw new IllegalFormatWidthException(width);

    if (precision != -1 && precision < 0)
        throw new IllegalFormatPrecisionException(precision);

    // '-' and '0' require a width
    if (width == -1
        && (f.contains(Flags.LEFT_JUSTIFY) || f.contains(Flags.ZERO_PAD)))
        throw new MissingFormatWidthException(toString());

    // bad combination
    if ((f.contains(Flags.PLUS) && f.contains(Flags.LEADING_SPACE))
        || (f.contains(Flags.LEFT_JUSTIFY) && f.contains(Flags.ZERO_PAD)))
        throw new IllegalFormatFlagsException(f.toString());
}
项目:bazel    文件:FormatSpecifier.java   
private void checkNumeric() {
    if (width != -1 && width < 0)
        throw new IllegalFormatWidthException(width);

    if (precision != -1 && precision < 0)
        throw new IllegalFormatPrecisionException(precision);

    // '-' and '0' require a width
    if (width == -1
            && (f.contains(Flags.LEFT_JUSTIFY) || f
                    .contains(Flags.ZERO_PAD)))
        throw new MissingFormatWidthException(toString());

    // bad combination
    if ((f.contains(Flags.PLUS) && f.contains(Flags.LEADING_SPACE))
            || (f.contains(Flags.LEFT_JUSTIFY) && f
                    .contains(Flags.ZERO_PAD)))
        throw new IllegalFormatFlagsException(f.toString());
}
项目:bazel    文件:FormatSpecifier.java   
private void checkText() {
    if (precision != -1)
        throw new IllegalFormatPrecisionException(precision);
    switch (c) {
    case Conversion.PERCENT_SIGN:
        if (f.valueOf() != Flags.LEFT_JUSTIFY.valueOf()
                && f.valueOf() != Flags.NONE.valueOf())
            throw new IllegalFormatFlagsException(f.toString());
        // '-' requires a width
        if (width == -1 && f.contains(Flags.LEFT_JUSTIFY))
            throw new MissingFormatWidthException(toString());
        break;
    case Conversion.LINE_SEPARATOR:
        if (width != -1)
            throw new IllegalFormatWidthException(width);
        if (f.valueOf() != Flags.NONE.valueOf())
            throw new IllegalFormatFlagsException(f.toString());
        break;
    default:
           throw new UnknownFormatConversionException(String.valueOf(c));
    }
}
项目:form-follows-function    文件:F3Formatter.java   
private int width(String s) {
    width = -1;
    if (s != null) {
        try {
            width  = Integer.parseInt(s);
            if (width < 0)
                throw new IllegalFormatWidthException(width);
        } catch (NumberFormatException x) {
            assert(false);
        }
    }
    return width;
}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
 */
public void test_illegalFormatWidthException() {
    int width = Integer.MAX_VALUE;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getWidth()
 */
public void test_getWidth() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getMessage()
 */
public void test_getMessage() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertTrue(null != illegalFormatWidthException.getMessage());

}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
    IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;

    assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
 */
public void test_illegalFormatWidthException() {
    int width = Integer.MAX_VALUE;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getWidth()
 */
public void test_getWidth() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getMessage()
 */
public void test_getMessage() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertTrue(null != illegalFormatWidthException.getMessage());

}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
    IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;

    assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
}
项目:bazel    文件:FormatSpecifier.java   
private int width(String s) throws FormatterNumberFormatException {
    width = -1;
    if (s != null) {
        try {
            width = Integer.parseInt(s);
            if (width < 0)
                throw new IllegalFormatWidthException(width);
        } catch (NumberFormatException x) {
               throw new FormatterNumberFormatException(s, "width");
        }
    }
    return width;
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
 */
public void test_illegalFormatWidthException() {
    int width = Integer.MAX_VALUE;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getWidth()
 */
public void test_getWidth() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getMessage()
 */
public void test_getMessage() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertTrue(null != illegalFormatWidthException.getMessage());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
    IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;

    assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
 */
public void test_illegalFormatWidthException() {
    int width = Integer.MAX_VALUE;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getWidth()
 */
public void test_getWidth() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertEquals(width, illegalFormatWidthException.getWidth());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests java.util.IllegalFormatWidthException#getMessage()
 */
public void test_getMessage() {
    int width = 12345;
    IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
            width);
    assertTrue(null != illegalFormatWidthException.getMessage());

}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
    IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;

    assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
            exComparator);
}
项目:In-the-Box-Fork    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
            12345), exComparator);
}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
            exComparator);
}
项目:cn1    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
            12345), exComparator);
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
            exComparator);
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
            12345), exComparator);
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
            exComparator);
}
项目:freeVM    文件:IllegalFormatWidthExceptionTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
            12345), exComparator);
}