KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > DuplicateFormatFlagsException


1 /*
2  * @(#)DuplicateFormatFlagsException.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 duplicate flags are provided in the format
12  * specifier.
13  *
14  * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
15  * method or constructor in this class will cause a {@link
16  * NullPointerException} to be thrown.
17  *
18  * @version 1.2, 12/19/03
19  * @since 1.5
20  */

21 public class DuplicateFormatFlagsException extends IllegalFormatException JavaDoc {
22
23     private static final long serialVersionUID = 18890531L;
24
25     private String JavaDoc flags;
26
27     /**
28      * Constructs an instance of this class with the specified flags.
29      *
30      * @param f
31      * The set of format flags which contain a duplicate flag.
32      */

33     public DuplicateFormatFlagsException(String JavaDoc f) {
34     if (f == null)
35         throw new NullPointerException JavaDoc();
36     this.flags = f;
37     }
38
39     /**
40      * Returns the set of flags which contains a duplicate flag.
41      *
42      * @return The flags
43      */

44     public String JavaDoc getFlags() {
45     return flags;
46     }
47
48     public String JavaDoc getMessage() {
49     return String.format("Flags = '%s'", flags);
50     }
51 }
52
Popular Tags