Java 类java.io.WriteAbortedException 实例源码

项目:In-the-Box-Fork    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#WriteAbortedException(java.lang.String,
 *        java.lang.Exception)
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "WriteAbortedException",
    args = {java.lang.String.class, java.lang.Exception.class}
)
public void test_ConstructorLjava_lang_StringLjava_lang_Exception() {
    // Test for method java.io.WriteAbortedException(java.lang.String,
    // java.lang.Exception)
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:In-the-Box-Fork    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#getMessage()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getCause",
    args = {}
)
public void test_getCause() {
    try {
        if (true) {
            throw new WriteAbortedException("HelloWorld",
                    new IOException("Something went wrong."));
        }
        fail("Test 1: WriteAbortedException expected.");
    } catch (WriteAbortedException e) {
        Throwable cause = e.getCause();
        assertTrue("Test 2: Incorrect exception cause: " + cause,
                cause.getClass().equals(IOException.class) &&
                cause.getMessage().equals("Something went wrong."));
    }
}
项目:In-the-Box-Fork    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#getMessage()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getMessage",
    args = {}
)
public void test_getMessage() {
    // Test for method java.lang.String
    // java.io.WriteAbortedException.getMessage()
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        assertTrue("WriteAbortedException::getMessage() failed"
                + e.getMessage(), e.getMessage().equals(
                "HelloWorld; java.io.WriteAbortedException: ByeWorld"));
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:cn1    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#getMessage()
 */
public void test_getMessage() {
    // Test for method java.lang.String
    // java.io.WriteAbortedException.getMessage()
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        assertTrue("WriteAbortedException::getMessage() failed"
                + e.getMessage(), e.getMessage().equals(
                "HelloWorld; java.io.WriteAbortedException: ByeWorld"));
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:freeVM    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#getMessage()
 */
public void test_getMessage() {
    // Test for method java.lang.String
    // java.io.WriteAbortedException.getMessage()
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        assertTrue("WriteAbortedException::getMessage() failed"
                + e.getMessage(), e.getMessage().equals(
                "HelloWorld; java.io.WriteAbortedException: ByeWorld"));
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:freeVM    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#getMessage()
 */
public void test_getMessage() {
    // Test for method java.lang.String
    // java.io.WriteAbortedException.getMessage()
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        assertTrue("WriteAbortedException::getMessage() failed"
                + e.getMessage(), e.getMessage().equals(
                "HelloWorld; java.io.WriteAbortedException: ByeWorld"));
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:cn1    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#WriteAbortedException(java.lang.String,
 *        java.lang.Exception)
 */
public void test_ConstructorLjava_lang_StringLjava_lang_Exception() {
    // Test for method java.io.WriteAbortedException(java.lang.String,
    // java.lang.Exception)
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:freeVM    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#WriteAbortedException(java.lang.String,
 *        java.lang.Exception)
 */
public void test_ConstructorLjava_lang_StringLjava_lang_Exception() {
    // Test for method java.io.WriteAbortedException(java.lang.String,
    // java.lang.Exception)
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:freeVM    文件:WriteAbortedExceptionTest.java   
/**
 * @tests java.io.WriteAbortedException#WriteAbortedException(java.lang.String,
 *        java.lang.Exception)
 */
public void test_ConstructorLjava_lang_StringLjava_lang_Exception() {
    // Test for method java.io.WriteAbortedException(java.lang.String,
    // java.lang.Exception)
    try {
        if (true)
            throw new WriteAbortedException("HelloWorld",
                    new WriteAbortedException("ByeWorld", null));
    } catch (WriteAbortedException e) {
        return;
    }
    fail("Failed to generate expected Exception");
}
项目:tomcat7    文件:DeltaSession.java   
private void readObject(ObjectInput stream) throws ClassNotFoundException, IOException {

        // Deserialize the scalar instance variables (except Manager)
        authType = null; // Transient only
        creationTime = ( (Long) stream.readObject()).longValue();
        lastAccessedTime = ( (Long) stream.readObject()).longValue();
        maxInactiveInterval = ( (Integer) stream.readObject()).intValue();
        isNew = ( (Boolean) stream.readObject()).booleanValue();
        isValid = ( (Boolean) stream.readObject()).booleanValue();
        thisAccessedTime = ( (Long) stream.readObject()).longValue();
        version = ( (Long) stream.readObject()).longValue();
        boolean hasPrincipal = stream.readBoolean();
        principal = null;
        if (hasPrincipal) {
            principal = SerializablePrincipal.readPrincipal(stream);
        }

        //        setId((String) stream.readObject());
        id = (String) stream.readObject();
        if (log.isDebugEnabled()) log.debug(sm.getString("deltaSession.readSession", id));

        // Deserialize the attribute count and attribute values
        if (attributes == null) attributes = new ConcurrentHashMap<String, Object>();
        int n = ( (Integer) stream.readObject()).intValue();
        boolean isValidSave = isValid;
        isValid = true;
        for (int i = 0; i < n; i++) {
            String name = (String) stream.readObject();
            final Object value;
            try {
                value = stream.readObject();
            } catch (WriteAbortedException wae) {
                if (wae.getCause() instanceof NotSerializableException) {
                    // Skip non serializable attributes
                    continue;
                }
                throw wae;
            }
            // Handle the case where the filter configuration was changed while
            // the web application was stopped.
            if (exclude(name, value)) {
                continue;
            }
            attributes.put(name, value);
        }
        isValid = isValidSave;

        // Session listeners
        n = ((Integer) stream.readObject()).intValue();
        if (listeners == null || n > 0) {
            listeners = new ArrayList<SessionListener>();
        }
        for (int i = 0; i < n; i++) {
            SessionListener listener = (SessionListener) stream.readObject();
            listeners.add(listener);
        }

        if (notes == null) {
            notes = new Hashtable<String,Object>();
        }
        activate();
    }
项目:tomcat7    文件:StandardSession.java   
/**
 * Read a serialized version of this session object from the specified
 * object input stream.
 * <p>
 * <b>IMPLEMENTATION NOTE</b>:  The reference to the owning Manager
 * is not restored by this method, and must be set explicitly.
 *
 * @param stream The input stream to read from
 *
 * @exception ClassNotFoundException if an unknown class is specified
 * @exception IOException if an input/output error occurs
 */
protected void readObject(ObjectInputStream stream)
    throws ClassNotFoundException, IOException {

    // Deserialize the scalar instance variables (except Manager)
    authType = null;        // Transient only
    creationTime = ((Long) stream.readObject()).longValue();
    lastAccessedTime = ((Long) stream.readObject()).longValue();
    maxInactiveInterval = ((Integer) stream.readObject()).intValue();
    isNew = ((Boolean) stream.readObject()).booleanValue();
    isValid = ((Boolean) stream.readObject()).booleanValue();
    thisAccessedTime = ((Long) stream.readObject()).longValue();
    principal = null;        // Transient only
    //        setId((String) stream.readObject());
    id = (String) stream.readObject();
    if (manager.getContainer().getLogger().isDebugEnabled())
        manager.getContainer().getLogger().debug
            ("readObject() loading session " + id);

    // Deserialize the attribute count and attribute values
    if (attributes == null)
        attributes = new ConcurrentHashMap<String, Object>();
    int n = ((Integer) stream.readObject()).intValue();
    boolean isValidSave = isValid;
    isValid = true;
    for (int i = 0; i < n; i++) {
        String name = (String) stream.readObject();
        final Object value;
        try {
            value = stream.readObject();
        } catch (WriteAbortedException wae) {
            if (wae.getCause() instanceof NotSerializableException) {
                String msg = sm.getString("standardSession.notDeserializable", name, id);
                if (manager.getContainer().getLogger().isDebugEnabled()) {
                    manager.getContainer().getLogger().debug(msg, wae);
                } else {
                    manager.getContainer().getLogger().warn(msg);
                }
                // Skip non serializable attributes
                continue;
            }
            throw wae;
        }
        if (manager.getContainer().getLogger().isDebugEnabled())
            manager.getContainer().getLogger().debug("  loading attribute '" + name +
                "' with value '" + value + "'");
        // Handle the case where the filter configuration was changed while
        // the web application was stopped.
        if (exclude(name, value)) {
            continue;
        }
        attributes.put(name, value);
    }
    isValid = isValidSave;

    if (listeners == null) {
        listeners = new ArrayList<SessionListener>();
    }

    if (notes == null) {
        notes = new Hashtable<String, Object>();
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:DeltaSession.java   
private void readObject(ObjectInput stream) throws ClassNotFoundException, IOException {

        // Deserialize the scalar instance variables (except Manager)
        authType = null; // Transient only
        creationTime = ( (Long) stream.readObject()).longValue();
        lastAccessedTime = ( (Long) stream.readObject()).longValue();
        maxInactiveInterval = ( (Integer) stream.readObject()).intValue();
        isNew = ( (Boolean) stream.readObject()).booleanValue();
        isValid = ( (Boolean) stream.readObject()).booleanValue();
        thisAccessedTime = ( (Long) stream.readObject()).longValue();
        version = ( (Long) stream.readObject()).longValue();
        boolean hasPrincipal = stream.readBoolean();
        principal = null;
        if (hasPrincipal) {
            principal = SerializablePrincipal.readPrincipal(stream);
        }

        //        setId((String) stream.readObject());
        id = (String) stream.readObject();
        if (log.isDebugEnabled()) log.debug(sm.getString("deltaSession.readSession", id));

        // Deserialize the attribute count and attribute values
        if (attributes == null) attributes = new ConcurrentHashMap<String, Object>();
        int n = ( (Integer) stream.readObject()).intValue();
        boolean isValidSave = isValid;
        isValid = true;
        for (int i = 0; i < n; i++) {
            String name = (String) stream.readObject();
            final Object value;
            try {
                value = stream.readObject();
            } catch (WriteAbortedException wae) {
                if (wae.getCause() instanceof NotSerializableException) {
                    // Skip non serializable attributes
                    continue;
                }
                throw wae;
            }
            // Handle the case where the filter configuration was changed while
            // the web application was stopped.
            if (exclude(name, value)) {
                continue;
            }
            attributes.put(name, value);
        }
        isValid = isValidSave;

        // Session listeners
        n = ((Integer) stream.readObject()).intValue();
        if (listeners == null || n > 0) {
            listeners = new ArrayList<SessionListener>();
        }
        for (int i = 0; i < n; i++) {
            SessionListener listener = (SessionListener) stream.readObject();
            listeners.add(listener);
        }

        if (notes == null) {
            notes = new Hashtable<String,Object>();
        }
        activate();
    }
项目:apache-tomcat-7.0.73-with-comment    文件:StandardSession.java   
/**
 * Read a serialized version of this session object from the specified
 * object input stream.
 * <p>
 * <b>IMPLEMENTATION NOTE</b>:  The reference to the owning Manager
 * is not restored by this method, and must be set explicitly.
 *
 * @param stream The input stream to read from
 *
 * @exception ClassNotFoundException if an unknown class is specified
 * @exception IOException if an input/output error occurs
 */
protected void readObject(ObjectInputStream stream)
    throws ClassNotFoundException, IOException {

    // Deserialize the scalar instance variables (except Manager)
    authType = null;        // Transient only
    creationTime = ((Long) stream.readObject()).longValue();
    lastAccessedTime = ((Long) stream.readObject()).longValue();
    maxInactiveInterval = ((Integer) stream.readObject()).intValue();
    isNew = ((Boolean) stream.readObject()).booleanValue();
    isValid = ((Boolean) stream.readObject()).booleanValue();
    thisAccessedTime = ((Long) stream.readObject()).longValue();
    principal = null;        // Transient only
    //        setId((String) stream.readObject());
    id = (String) stream.readObject();
    if (manager.getContainer().getLogger().isDebugEnabled())
        manager.getContainer().getLogger().debug
            ("readObject() loading session " + id);

    // Deserialize the attribute count and attribute values
    if (attributes == null)
        attributes = new ConcurrentHashMap<String, Object>();
    int n = ((Integer) stream.readObject()).intValue();
    boolean isValidSave = isValid;
    isValid = true;
    for (int i = 0; i < n; i++) {
        String name = (String) stream.readObject();
        final Object value;
        try {
            value = stream.readObject();
        } catch (WriteAbortedException wae) {
            if (wae.getCause() instanceof NotSerializableException) {
                String msg = sm.getString("standardSession.notDeserializable", name, id);
                if (manager.getContainer().getLogger().isDebugEnabled()) {
                    manager.getContainer().getLogger().debug(msg, wae);
                } else {
                    manager.getContainer().getLogger().warn(msg);
                }
                // Skip non serializable attributes
                continue;
            }
            throw wae;
        }
        if (manager.getContainer().getLogger().isDebugEnabled())
            manager.getContainer().getLogger().debug("  loading attribute '" + name +
                "' with value '" + value + "'");
        // Handle the case where the filter configuration was changed while
        // the web application was stopped.
        if (exclude(name, value)) {
            continue;
        }
        attributes.put(name, value);
    }
    isValid = isValidSave;

    if (listeners == null) {
        listeners = new ArrayList<SessionListener>();
    }

    if (notes == null) {
        notes = new Hashtable<String, Object>();
    }
}
项目:lazycat    文件:DeltaSession.java   
private void readObject(ObjectInput stream) throws ClassNotFoundException, IOException {

        // Deserialize the scalar instance variables (except Manager)
        authType = null; // Transient only
        creationTime = ((Long) stream.readObject()).longValue();
        lastAccessedTime = ((Long) stream.readObject()).longValue();
        maxInactiveInterval = ((Integer) stream.readObject()).intValue();
        isNew = ((Boolean) stream.readObject()).booleanValue();
        isValid = ((Boolean) stream.readObject()).booleanValue();
        thisAccessedTime = ((Long) stream.readObject()).longValue();
        version = ((Long) stream.readObject()).longValue();
        boolean hasPrincipal = stream.readBoolean();
        principal = null;
        if (hasPrincipal) {
            principal = SerializablePrincipal.readPrincipal(stream);
        }

        // setId((String) stream.readObject());
        id = (String) stream.readObject();
        if (log.isDebugEnabled())
            log.debug(sm.getString("deltaSession.readSession", id));

        // Deserialize the attribute count and attribute values
        if (attributes == null)
            attributes = new ConcurrentHashMap<String, Object>();
        int n = ((Integer) stream.readObject()).intValue();
        boolean isValidSave = isValid;
        isValid = true;
        for (int i = 0; i < n; i++) {
            String name = (String) stream.readObject();
            final Object value;
            try {
                value = stream.readObject();
            } catch (WriteAbortedException wae) {
                if (wae.getCause() instanceof NotSerializableException) {
                    // Skip non serializable attributes
                    continue;
                }
                throw wae;
            }
            // Handle the case where the filter configuration was changed while
            // the web application was stopped.
            if (exclude(name, value)) {
                continue;
            }
            attributes.put(name, value);
        }
        isValid = isValidSave;

        // Session listeners
        n = ((Integer) stream.readObject()).intValue();
        if (listeners == null || n > 0) {
            listeners = new ArrayList<SessionListener>();
        }
        for (int i = 0; i < n; i++) {
            SessionListener listener = (SessionListener) stream.readObject();
            listeners.add(listener);
        }

        if (notes == null) {
            notes = new Hashtable<String, Object>();
        }
        activate();
    }
项目:lazycat    文件:StandardSession.java   
/**
 * Read a serialized version of this session object from the specified
 * object input stream.
 * <p>
 * <b>IMPLEMENTATION NOTE</b>: The reference to the owning Manager is not
 * restored by this method, and must be set explicitly.
 *
 * @param stream
 *            The input stream to read from
 *
 * @exception ClassNotFoundException
 *                if an unknown class is specified
 * @exception IOException
 *                if an input/output error occurs
 */
protected void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {

    // Deserialize the scalar instance variables (except Manager)
    authType = null; // Transient only
    creationTime = ((Long) stream.readObject()).longValue();
    lastAccessedTime = ((Long) stream.readObject()).longValue();
    maxInactiveInterval = ((Integer) stream.readObject()).intValue();
    isNew = ((Boolean) stream.readObject()).booleanValue();
    isValid = ((Boolean) stream.readObject()).booleanValue();
    thisAccessedTime = ((Long) stream.readObject()).longValue();
    principal = null; // Transient only
    // setId((String) stream.readObject());
    id = (String) stream.readObject();
    if (manager.getContainer().getLogger().isDebugEnabled())
        manager.getContainer().getLogger().debug("readObject() loading session " + id);

    // Deserialize the attribute count and attribute values
    if (attributes == null)
        attributes = new ConcurrentHashMap<String, Object>();
    int n = ((Integer) stream.readObject()).intValue();
    boolean isValidSave = isValid;
    isValid = true;
    for (int i = 0; i < n; i++) {
        String name = (String) stream.readObject();
        final Object value;
        try {
            value = stream.readObject();
        } catch (WriteAbortedException wae) {
            if (wae.getCause() instanceof NotSerializableException) {
                String msg = sm.getString("standardSession.notDeserializable", name, id);
                if (manager.getContainer().getLogger().isDebugEnabled()) {
                    manager.getContainer().getLogger().debug(msg, wae);
                } else {
                    manager.getContainer().getLogger().warn(msg);
                }
                // Skip non serializable attributes
                continue;
            }
            throw wae;
        }
        if (manager.getContainer().getLogger().isDebugEnabled())
            manager.getContainer().getLogger()
                    .debug("  loading attribute '" + name + "' with value '" + value + "'");
        // Handle the case where the filter configuration was changed while
        // the web application was stopped.
        if (exclude(name, value)) {
            continue;
        }
        attributes.put(name, value);
    }
    isValid = isValidSave;

    if (listeners == null) {
        listeners = new ArrayList<SessionListener>();
    }

    if (notes == null) {
        notes = new Hashtable<String, Object>();
    }
}
项目:jdk7-jdk    文件:RMIConnector.java   
protected NotificationResult fetchNotifs(long clientSequenceNumber,
        int maxNotifications,
        long timeout)
        throws IOException, ClassNotFoundException {
    IOException org;

    while (true) { // used for a successful re-connection
        try {
            return connection.fetchNotifications(clientSequenceNumber,
                    maxNotifications,
                    timeout);
        } catch (IOException ioe) {
            org = ioe;

            // inform of IOException
            try {
                communicatorAdmin.gotIOException(ioe);

                // The connection should be re-established.
                continue;
            } catch (IOException ee) {
                // No more fetch, the Exception will be re-thrown.
                break;
            } // never reached
        } // never reached
    }

    // specially treating for an UnmarshalException
    if (org instanceof UnmarshalException) {
        UnmarshalException ume = (UnmarshalException)org;

        if (ume.detail instanceof ClassNotFoundException)
            throw (ClassNotFoundException) ume.detail;

        /* In Sun's RMI implementation, if a method return
           contains an unserializable object, then we get
           UnmarshalException wrapping WriteAbortedException
           wrapping NotSerializableException.  In that case we
           extract the NotSerializableException so that our
           caller can realize it should try to skip past the
           notification that presumably caused it.  It's not
           certain that every other RMI implementation will
           generate this exact exception sequence.  If not, we
           will not detect that the problem is due to an
           unserializable object, and we will stop trying to
           receive notifications from the server.  It's not
           clear we can do much better.  */
        if (ume.detail instanceof WriteAbortedException) {
            WriteAbortedException wae =
                    (WriteAbortedException) ume.detail;
            if (wae.detail instanceof IOException)
                throw (IOException) wae.detail;
        }
    } else if (org instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)org;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, simply re-throw the orginal exception
    throw org;
}
项目:openjdk-source-code-learn    文件:RMIConnector.java   
protected NotificationResult fetchNotifs(long clientSequenceNumber,
        int maxNotifications,
        long timeout)
        throws IOException, ClassNotFoundException {
    IOException org;

    while (true) { // used for a successful re-connection
        try {
            return connection.fetchNotifications(clientSequenceNumber,
                    maxNotifications,
                    timeout);
        } catch (IOException ioe) {
            org = ioe;

            // inform of IOException
            try {
                communicatorAdmin.gotIOException(ioe);

                // The connection should be re-established.
                continue;
            } catch (IOException ee) {
                // No more fetch, the Exception will be re-thrown.
                break;
            } // never reached
        } // never reached
    }

    // specially treating for an UnmarshalException
    if (org instanceof UnmarshalException) {
        UnmarshalException ume = (UnmarshalException)org;

        if (ume.detail instanceof ClassNotFoundException)
            throw (ClassNotFoundException) ume.detail;

        /* In Sun's RMI implementation, if a method return
           contains an unserializable object, then we get
           UnmarshalException wrapping WriteAbortedException
           wrapping NotSerializableException.  In that case we
           extract the NotSerializableException so that our
           caller can realize it should try to skip past the
           notification that presumably caused it.  It's not
           certain that every other RMI implementation will
           generate this exact exception sequence.  If not, we
           will not detect that the problem is due to an
           unserializable object, and we will stop trying to
           receive notifications from the server.  It's not
           clear we can do much better.  */
        if (ume.detail instanceof WriteAbortedException) {
            WriteAbortedException wae =
                    (WriteAbortedException) ume.detail;
            if (wae.detail instanceof IOException)
                throw (IOException) wae.detail;
        }
    } else if (org instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)org;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, simply re-throw the orginal exception
    throw org;
}
项目:OLD-OpenJDK8    文件:RMIConnector.java   
protected NotificationResult fetchNotifs(long clientSequenceNumber,
        int maxNotifications,
        long timeout)
        throws IOException, ClassNotFoundException {
    IOException org;

    while (true) { // used for a successful re-connection
        try {
            return connection.fetchNotifications(clientSequenceNumber,
                    maxNotifications,
                    timeout);
        } catch (IOException ioe) {
            org = ioe;

            // inform of IOException
            try {
                communicatorAdmin.gotIOException(ioe);

                // The connection should be re-established.
                continue;
            } catch (IOException ee) {
                // No more fetch, the Exception will be re-thrown.
                break;
            } // never reached
        } // never reached
    }

    // specially treating for an UnmarshalException
    if (org instanceof UnmarshalException) {
        UnmarshalException ume = (UnmarshalException)org;

        if (ume.detail instanceof ClassNotFoundException)
            throw (ClassNotFoundException) ume.detail;

        /* In Sun's RMI implementation, if a method return
           contains an unserializable object, then we get
           UnmarshalException wrapping WriteAbortedException
           wrapping NotSerializableException.  In that case we
           extract the NotSerializableException so that our
           caller can realize it should try to skip past the
           notification that presumably caused it.  It's not
           certain that every other RMI implementation will
           generate this exact exception sequence.  If not, we
           will not detect that the problem is due to an
           unserializable object, and we will stop trying to
           receive notifications from the server.  It's not
           clear we can do much better.  */
        if (ume.detail instanceof WriteAbortedException) {
            WriteAbortedException wae =
                    (WriteAbortedException) ume.detail;
            if (wae.detail instanceof IOException)
                throw (IOException) wae.detail;
        }
    } else if (org instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)org;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, simply re-throw the orginal exception
    throw org;
}
项目:openjdk-jdk7u-jdk    文件:RMIConnector.java   
protected NotificationResult fetchNotifs(long clientSequenceNumber,
        int maxNotifications,
        long timeout)
        throws IOException, ClassNotFoundException {
    IOException org;

    while (true) { // used for a successful re-connection
        try {
            return connection.fetchNotifications(clientSequenceNumber,
                    maxNotifications,
                    timeout);
        } catch (IOException ioe) {
            org = ioe;

            // inform of IOException
            try {
                communicatorAdmin.gotIOException(ioe);

                // The connection should be re-established.
                continue;
            } catch (IOException ee) {
                // No more fetch, the Exception will be re-thrown.
                break;
            } // never reached
        } // never reached
    }

    // specially treating for an UnmarshalException
    if (org instanceof UnmarshalException) {
        UnmarshalException ume = (UnmarshalException)org;

        if (ume.detail instanceof ClassNotFoundException)
            throw (ClassNotFoundException) ume.detail;

        /* In Sun's RMI implementation, if a method return
           contains an unserializable object, then we get
           UnmarshalException wrapping WriteAbortedException
           wrapping NotSerializableException.  In that case we
           extract the NotSerializableException so that our
           caller can realize it should try to skip past the
           notification that presumably caused it.  It's not
           certain that every other RMI implementation will
           generate this exact exception sequence.  If not, we
           will not detect that the problem is due to an
           unserializable object, and we will stop trying to
           receive notifications from the server.  It's not
           clear we can do much better.  */
        if (ume.detail instanceof WriteAbortedException) {
            WriteAbortedException wae =
                    (WriteAbortedException) ume.detail;
            if (wae.detail instanceof IOException)
                throw (IOException) wae.detail;
        }
    } else if (org instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)org;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, simply re-throw the orginal exception
    throw org;
}
项目:serialysis    文件:SerialScan.java   
private void exception() throws IOException {
    reset();
    IOException exc = new IOException(readObject().toString());
    reset();
    throw new WriteAbortedException("Writing aborted", exc);
}
项目:openjdk-icedtea7    文件:RMIConnector.java   
protected NotificationResult fetchNotifs(long clientSequenceNumber,
        int maxNotifications,
        long timeout)
        throws IOException, ClassNotFoundException {
    IOException org;

    while (true) { // used for a successful re-connection
        try {
            return connection.fetchNotifications(clientSequenceNumber,
                    maxNotifications,
                    timeout);
        } catch (IOException ioe) {
            org = ioe;

            // inform of IOException
            try {
                communicatorAdmin.gotIOException(ioe);

                // The connection should be re-established.
                continue;
            } catch (IOException ee) {
                // No more fetch, the Exception will be re-thrown.
                break;
            } // never reached
        } // never reached
    }

    // specially treating for an UnmarshalException
    if (org instanceof UnmarshalException) {
        UnmarshalException ume = (UnmarshalException)org;

        if (ume.detail instanceof ClassNotFoundException)
            throw (ClassNotFoundException) ume.detail;

        /* In Sun's RMI implementation, if a method return
           contains an unserializable object, then we get
           UnmarshalException wrapping WriteAbortedException
           wrapping NotSerializableException.  In that case we
           extract the NotSerializableException so that our
           caller can realize it should try to skip past the
           notification that presumably caused it.  It's not
           certain that every other RMI implementation will
           generate this exact exception sequence.  If not, we
           will not detect that the problem is due to an
           unserializable object, and we will stop trying to
           receive notifications from the server.  It's not
           clear we can do much better.  */
        if (ume.detail instanceof WriteAbortedException) {
            WriteAbortedException wae =
                    (WriteAbortedException) ume.detail;
            if (wae.detail instanceof IOException)
                throw (IOException) wae.detail;
        }
    } else if (org instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)org;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, simply re-throw the orginal exception
    throw org;
}
项目:Ember    文件:Backup.java   
/**
 * Loads a world from the backup folder and copies it in the worlds folder
 * under the same name.
 *
 * @param backupName The backup worldname
 * @throws WriteAbortedException If the world already exists
 */
public void load(String backupName) throws WriteAbortedException {
    this.load(backupName, backupName, false);
}
项目:Ember    文件:Backup.java   
/**
 * Loads a world from the backup folder and copies it in the worlds folder
 * under a different name.
 *
 * @param backupName The world name in the backups
 * @param worldName The destination world name
 * @throws WriteAbortedException If the world already exists.
 */
public void load(String backupName, String worldName) throws WriteAbortedException {
    this.load(backupName, worldName, false);
}