Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 1996-2005 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.io;

Signals that one of the ObjectStreamExceptions was thrown during a write operation. Thrown during a read operation when one of the ObjectStreamExceptions was thrown during a write operation. The exception that terminated the write can be found in the detail field. The stream is reset to it's initial state and all references to objects already deserialized are discarded.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "exception causing the abort" that is provided at construction time and accessed via the public detail field is now known as the cause, and may be accessed via the java.lang.Throwable.getCause() method, as well as the aforementioned "legacy field."

Author(s):
unascribed
Since:
JDK1.1
    private static final long serialVersionUID = -3326426625597282442L;

    
Exception that was caught while writing the ObjectStream.

This field predates the general-purpose exception chaining facility. The java.lang.Throwable.getCause() method is now the preferred means of obtaining this information.

Serial:
    public Exception detail;

    
Constructs a WriteAbortedException with a string describing the exception and the exception causing the abort.

Parameters:
s String describing the exception.
ex Exception causing the abort.
    public WriteAbortedException(String sException ex) {
        super(s);
        initCause(null);  // Disallow subsequent initCause
         = ex;
    }

    
Produce the message and include the message from the nested exception, if there is one.
    public String getMessage() {
        if ( == null)
            return super.getMessage();
        else
            return super.getMessage() + "; " + .toString();
    }

    
Returns the exception that terminated the operation (the cause).

Returns:
the exception that terminated the operation (the cause), which may be null.
Since:
1.4
    public Throwable getCause() {
        return ;
    }
New to GrepCode? Check out our FAQ X