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. package java.util;
  8. /**
  9. * Unchecked exception thrown when there is a format specifier which does not
  10. * have a corresponding argument or if an argument index refers to an argument
  11. * that does not exist.
  12. *
  13. * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
  14. * method or constructor in this class will cause a {@link
  15. * NullPointerException} to be thrown.
  16. *
  17. * @version 1.2, 12/19/03
  18. * @since 1.5
  19. */
  20. public class MissingFormatArgumentException extends IllegalFormatException {
  21. private static final long serialVersionUID = 19190115L;
  22. private String s;
  23. /**
  24. * Constructs an instance of this class with the unmatched format
  25. * specifier.
  26. *
  27. * @param s
  28. * Format specifier which does not have a corresponding argument
  29. */
  30. public MissingFormatArgumentException(String s) {
  31. if (s == null)
  32. throw new NullPointerException();
  33. this.s = s;
  34. }
  35. /**
  36. * Returns the unmatched format specifier.
  37. *
  38. * @return The unmatched format specifier
  39. */
  40. public String getFormatSpecifier() {
  41. return s;
  42. }
  43. public String getMessage() {
  44. return "Format specifier '" + s + "'";
  45. }
  46. }