1. /*
  2. * @(#)IllegalFormatCodePointException.java 1.2 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.util;
  8. /**
  9. * Unchecked exception thrown when a character with an invalid Unicode code
  10. * point as defined by {@link Character#isValidCodePoint} is passed to the
  11. * {@link Formatter}.
  12. *
  13. * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
  14. * method or constructor in this class will cause a {@link
  15. * NullPointerException} to be thrown.
  16. *
  17. * @version 1.2, 12/19/03
  18. * @since 1.5
  19. */
  20. public class IllegalFormatCodePointException extends IllegalFormatException {
  21. private static final long serialVersionUID = 19080630L;
  22. private int c;
  23. /**
  24. * Constructs an instance of this class with the specified illegal code
  25. * point as defined by {@link Character#isValidCodePoint}.
  26. *
  27. * @param c
  28. * The illegal Unicode code point
  29. */
  30. public IllegalFormatCodePointException(int c) {
  31. this.c = c;
  32. }
  33. /**
  34. * Returns the illegal code point as defined by {@link
  35. * Character#isValidCodePoint}.
  36. *
  37. * @return The illegal Unicode code point
  38. */
  39. public int getCodePoint() {
  40. return c;
  41. }
  42. public String getMessage() {
  43. return String.format("Code point = %c", c);
  44. }
  45. }