| MissingFormatWidthException.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 the format width is required.
12 *
13 * <p> Unless otherwise specified, passing a <tt>null</tt> argument to anyg
14 * method or constructor in this class will cause a {@link
15 * NullPointerException} to be thrown.
16 *
17 * @version %I%, %G%
18 * @since 1.5
19 */
20 public class MissingFormatWidthException extends IllegalFormatException {
21
22 private static final long serialVersionUID = 15560123L;
23
24 private String s;
25
26 /**
27 * Constructs an instance of this class with the specified format
28 * specifier.
29 *
30 * @param s
31 * The format specifier which does not have a width
32 */
33 public MissingFormatWidthException(String s) {
34 if (s == null)
35 throw new NullPointerException();
36 this.s = s;
37 }
38
39 /**
40 * Returns the format specifier which does not have a width.
41 *
42 * @return The format specifier which does not have a width
43 */
44 public String getFormatSpecifier() {
45 return s;
46 }
47
48 public String getMessage() {
49 return s;
50 }
51 }
52