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