Package java.util

Examples of java.util.IllegalFormatPrecisionException


      throw new IllegalFormatFlagsException(f.toString());
  }

  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());
View Full Code Here


    /**
     * @tests java.util.IllegalFormatPrecisionException#IllegalFormatPrecisionException(int)
     */
    public void test_illegalFormatPrecisionException() {
        IllegalFormatPrecisionException illegalFormatPrecisionException = new IllegalFormatPrecisionException(
                Integer.MIN_VALUE);
        assertEquals(Integer.MIN_VALUE, illegalFormatPrecisionException
                .getPrecision());
    }
View Full Code Here

    /**
     * @tests java.util.IllegalFormatPrecisionException#getPrecision()
     */
    public void test_getPrecision() {
        int precision = 12345;
        IllegalFormatPrecisionException illegalFormatPrecisionException = new IllegalFormatPrecisionException(
                precision);
        assertEquals(precision, illegalFormatPrecisionException.getPrecision());
    }
View Full Code Here

    /**
     * @tests method for 'java.util.IllegalFormatPrecisionException#getMessage()
     */
    public void test_getMessage() {
        int precision = 12345;
        IllegalFormatPrecisionException illegalFormatPrecisionException = new IllegalFormatPrecisionException(
                precision);
        assertTrue(null != illegalFormatPrecisionException.getMessage());

    }
View Full Code Here

     * @tests serialization/deserialization.
     */
    public void testSerializationSelf() throws Exception {

        SerializationTest.verifySelf(
                new IllegalFormatPrecisionException(12345), exComparator);
    }
View Full Code Here

     * @tests serialization/deserialization compatibility with RI.
     */
    public void testSerializationCompatibility() throws Exception {

        SerializationTest.verifyGolden(this,
                new IllegalFormatPrecisionException(12345), exComparator);
    }
View Full Code Here

    if (s != null) {
      try {
        // remove the '.'
        precision = Integer.parseInt(s.substring(1));
        if (precision < 0)
          throw new IllegalFormatPrecisionException(precision);
      } catch (NumberFormatException x) {
                throw new FormatterNumberFormatException(s, "precision");
      }
    }
    return precision;
View Full Code Here

        Flags.GROUP, Flags.PARENTHESES);
  }

  private void checkDateTime() throws FormatFlagsConversionMismatchException {
    if (precision != -1)
      throw new IllegalFormatPrecisionException(precision);
    if (!DateTime.isValid(c))
      throw new UnknownFormatConversionException("t" + c);
    checkBadFlags(Flags.ALTERNATE, Flags.PLUS, Flags.LEADING_SPACE,
        Flags.ZERO_PAD, Flags.GROUP, Flags.PARENTHESES);
    // '-' requires a width
View Full Code Here

      throw new MissingFormatWidthException(toString());
  }

  private void checkCharacter() throws FormatFlagsConversionMismatchException {
    if (precision != -1)
      throw new IllegalFormatPrecisionException(precision);
    checkBadFlags(Flags.ALTERNATE, Flags.PLUS, Flags.LEADING_SPACE,
        Flags.ZERO_PAD, Flags.GROUP, Flags.PARENTHESES);
    // '-' requires a width
    if (width == -1 && f.contains(Flags.LEFT_JUSTIFY))
      throw new MissingFormatWidthException(toString());
View Full Code Here

  }

  private void checkInteger() throws FormatFlagsConversionMismatchException {
    checkNumeric();
    if (precision != -1)
      throw new IllegalFormatPrecisionException(precision);

    if (c == Conversion.DECIMAL_INTEGER)
      checkBadFlags(Flags.ALTERNATE);
    else
      checkBadFlags(Flags.GROUP);
View Full Code Here

TOP

Related Classes of java.util.IllegalFormatPrecisionException

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.