1. /*
  2. * @(#)BadLocationException.java 1.19 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.text;
  8. /**
  9. * This exception is to report bad locations within a document model
  10. * (that is, attempts to reference a location that doesn't exist).
  11. * <p>
  12. * <strong>Warning:</strong>
  13. * Serialized objects of this class will not be compatible with
  14. * future Swing releases. The current serialization support is
  15. * appropriate for short term storage or RMI between applications running
  16. * the same version of Swing. As of 1.4, support for long term storage
  17. * of all JavaBeans<sup><font size="-2">TM</font></sup>
  18. * has been added to the <code>java.beans</code> package.
  19. * Please see {@link java.beans.XMLEncoder}.
  20. *
  21. * @author Timothy Prinzing
  22. * @version 1.19 01/23/03
  23. */
  24. public class BadLocationException extends Exception
  25. {
  26. /**
  27. * Creates a new BadLocationException object.
  28. *
  29. * @param s a string indicating what was wrong with the arguments
  30. * @param offs offset within the document that was requested >= 0
  31. */
  32. public BadLocationException(String s, int offs) {
  33. super(s);
  34. this.offs = offs;
  35. }
  36. /**
  37. * Returns the offset into the document that was not legal.
  38. *
  39. * @return the offset >= 0
  40. */
  41. public int offsetRequested() {
  42. return offs;
  43. }
  44. private int offs;
  45. }