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