KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > MissingFormatArgumentException


1 /*
2  * @(#)MissingFormatArgumentException.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
8 package java.util;
9
10 /**
11  * Unchecked exception thrown when there is a format specifier which does not
12  * have a corresponding argument or if an argument index refers to an argument
13  * that does not exist.
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 1.2, 12/19/03
20  * @since 1.5
21  */

22 public class MissingFormatArgumentException extends IllegalFormatException JavaDoc {
23
24     private static final long serialVersionUID = 19190115L;
25
26     private String JavaDoc s;
27
28     /**
29      * Constructs an instance of this class with the unmatched format
30      * specifier.
31      *
32      * @param s
33      * Format specifier which does not have a corresponding argument
34      */

35     public MissingFormatArgumentException(String JavaDoc s) {
36     if (s == null)
37         throw new NullPointerException JavaDoc();
38     this.s = s;
39     }
40
41     /**
42      * Returns the unmatched format specifier.
43      *
44      * @return The unmatched format specifier
45      */

46     public String JavaDoc getFormatSpecifier() {
47     return s;
48     }
49
50     public String JavaDoc getMessage() {
51     return "Format specifier '" + s + "'";
52     }
53 }
54
Popular Tags