Package java.util

Examples of java.util.IllegalFormatFlagsException


      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:
      assert false;
    }
  }
View Full Code Here


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

      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:
      assert false;
    }
  }
View Full Code Here

    /**
     * @tests java.util.IllegalFormatFlagsException#IllegalFormatFlagsException(String)
     */
    public void test_illegalFormatFlagsException() {
        try {
            new IllegalFormatFlagsException(null);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
    }
View Full Code Here

    /**
     * @tests java.util.IllegalFormatFlagsException.getFlags()
     */
    public void test_getFlags() {
        String flags = "TESTFLAGS";
        IllegalFormatFlagsException illegalFormatFlagsException = new IllegalFormatFlagsException(
                flags);
        assertEquals(flags, illegalFormatFlagsException.getFlags());
    }
View Full Code Here

    /**
     * @tests java.util.IllegalFormatFlagsException.getMessage()
     */
    public void test_getMessage() {
        String flags = "TESTFLAGS";
        IllegalFormatFlagsException illegalFormatFlagsException = new IllegalFormatFlagsException(
                flags);
        assertTrue(null != illegalFormatFlagsException.getMessage());

    }
View Full Code Here

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

        SerializationTest.verifySelf(new IllegalFormatFlagsException(
                "TESTFLAGS"), exComparator);
    }
View Full Code Here

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

        SerializationTest.verifyGolden(this, new IllegalFormatFlagsException(
                "TESTFLAGS"), exComparator);
    }
View Full Code Here

            else
              tokenReplacement = String.format ("%08x", Integer.valueOf (System.identityHashCode (token)));
            finalFormatBuilder.append ("%s");
            finalTokensBuilder.set (currentTokenIndex, tokenReplacement);
          } else
            throw (new IllegalFormatFlagsException (formatSpecification));
          currentTokenIndex++;
        } else {
          if (!formatSpecification.contains ("$") && !formatSpecification.contains ("$"))
            currentTokenIndex++;
        }
View Full Code Here

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

TOP

Related Classes of java.util.IllegalFormatFlagsException

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.