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 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     %I%, %G%
19   * @since 1.5
20   */
21  public class DuplicateFormatFlagsException extends IllegalFormatException {
22  
23      private static final long serialVersionUID = 18890531L;
24  
25      private String 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 f) {
34      if (f == null)
35          throw new NullPointerException();
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 getFlags() {
45      return flags;
46      }
47  
48      public String getMessage() {
49      return String.format("Flags = '%s'", flags);
50      }
51  }
52