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. package java.util;
  8. /**
  9. * Unchecked exception thrown when duplicate flags are provided in the format
  10. * specifier.
  11. *
  12. * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
  13. * method or constructor in this class will cause a {@link
  14. * NullPointerException} to be thrown.
  15. *
  16. * @version 1.2, 12/19/03
  17. * @since 1.5
  18. */
  19. public class DuplicateFormatFlagsException extends IllegalFormatException {
  20. private static final long serialVersionUID = 18890531L;
  21. private String flags;
  22. /**
  23. * Constructs an instance of this class with the specified flags.
  24. *
  25. * @param f
  26. * The set of format flags which contain a duplicate flag.
  27. */
  28. public DuplicateFormatFlagsException(String f) {
  29. if (f == null)
  30. throw new NullPointerException();
  31. this.flags = f;
  32. }
  33. /**
  34. * Returns the set of flags which contains a duplicate flag.
  35. *
  36. * @return The flags
  37. */
  38. public String getFlags() {
  39. return flags;
  40. }
  41. public String getMessage() {
  42. return String.format("Flags = '%s'", flags);
  43. }
  44. }