InvalidPreferencesFormatException.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* InvalidPreferencesFormatException - indicates reading prefs from stream
  2. failed
  3. Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
  4. This file is part of GNU Classpath.
  5. GNU Classpath is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. GNU Classpath is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Classpath; see the file COPYING. If not, write to the
  15. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA.
  17. Linking this library statically or dynamically with other modules is
  18. making a combined work based on this library. Thus, the terms and
  19. conditions of the GNU General Public License cover the whole
  20. combination.
  21. As a special exception, the copyright holders of this library give you
  22. permission to link this library with independent modules to produce an
  23. executable, regardless of the license terms of these independent
  24. modules, and to copy and distribute the resulting executable under
  25. terms of your choice, provided that you also meet, for each linked
  26. independent module, the terms and conditions of the license of that
  27. module. An independent module is a module which is not derived from
  28. or based on this library. If you modify this library, you may extend
  29. this exception to your version of the library, but you are not
  30. obligated to do so. If you do not wish to do so, delete this
  31. exception statement from your version. */
  32. package java.util.prefs;
  33. import java.io.NotSerializableException;
  34. import java.io.ObjectInputStream;
  35. import java.io.ObjectOutputStream;
  36. /**
  37. * Indicates reading prefs from stream failed. Thrown by the
  38. * <code>importPreferences()</code> method when the supplied input stream
  39. * could not be read because it was not in the correct XML format.
  40. *
  41. * <p>Note that although this class inherits the Serializable interface, an
  42. * attempt to serialize will fail with a <code>NotSerializableException</code>.
  43. * </p>
  44. *
  45. * @author Mark Wielaard (mark@klomp.org)
  46. * @see Preferences
  47. * @since 1.4
  48. * @status updated to 1.4
  49. */
  50. public class InvalidPreferencesFormatException extends Exception
  51. {
  52. static final long serialVersionUID = -791715184232119669L;
  53. /**
  54. * Creates a new exception with a descriptive message. The cause remains
  55. * uninitialized.
  56. *
  57. * @param message the message
  58. */
  59. public InvalidPreferencesFormatException(String message)
  60. {
  61. super(message);
  62. }
  63. /**
  64. * Creates a new exception with the given cause.
  65. *
  66. * @param cause the cause
  67. */
  68. public InvalidPreferencesFormatException(Throwable cause)
  69. {
  70. super(cause);
  71. }
  72. /**
  73. * Creates a new exception with a descriptive message and a cause.
  74. *
  75. * @param message the message
  76. * @param cause the cause
  77. */
  78. public InvalidPreferencesFormatException(String message, Throwable cause)
  79. {
  80. super(message, cause);
  81. }
  82. /**
  83. * This class should not be serialized.
  84. *
  85. * @param o the output stream
  86. */
  87. private void writeObject(ObjectOutputStream o) throws NotSerializableException
  88. {
  89. throw new NotSerializableException
  90. ("java.util.prefs.InvalidPreferencesFormatException");
  91. }
  92. /**
  93. * This class should not be serialized.
  94. *
  95. * @param i the input stream
  96. */
  97. private void readObject(ObjectInputStream i) throws NotSerializableException
  98. {
  99. throw new NotSerializableException
  100. ("java.util.prefs.InvalidPreferencesFormatException");
  101. }
  102. }