1. /*
  2. * @(#)WriteAbortedException.java 1.12 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.io;
  11. /**
  12. * Signals that one of the ObjectStreamExceptions was thrown
  13. * during a write operation.
  14. *
  15. * @author unascribed
  16. * @version 1.12, 02/02/00
  17. * @since JDK1.1
  18. */
  19. public class WriteAbortedException extends ObjectStreamException {
  20. /**
  21. * Exception that was caught while writing the ObjectStream.
  22. * @serial
  23. */
  24. public Exception detail;
  25. /**
  26. * Thrown during a read operation when one of the
  27. * ObjectStreamExceptions was thrown during a write operation.
  28. * The exception that terminated the write can be found in the detail
  29. * field. The stream is reset to it's initial state andd all references
  30. * to objects already deserialized are discarded.
  31. *
  32. * @param s String describing the exception.
  33. * @param ex Exception causing the abort.
  34. */
  35. public WriteAbortedException(String s, Exception ex) {
  36. super(s);
  37. detail = ex;
  38. }
  39. /**
  40. * Produce the message and include the message from the nested
  41. * exception, if there is one.
  42. */
  43. public String getMessage() {
  44. if (detail == null)
  45. return super.getMessage();
  46. else
  47. return super.getMessage() + "; " + detail.toString();
  48. }
  49. }