Java Code Examples for java.io.WriteAbortedException#getCause()

The following examples show how to use java.io.WriteAbortedException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardSession.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * 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 doReadObject(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.getContext().getLogger().isDebugEnabled())
        manager.getContext().getLogger().debug
            ("readObject() loading session " + id);

    // Deserialize the attribute count and attribute values
    if (attributes == null)
        attributes = new ConcurrentHashMap<>();
    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.getContext().getLogger().isDebugEnabled()) {
                    manager.getContext().getLogger().debug(msg, wae);
                } else {
                    manager.getContext().getLogger().warn(msg);
                }
                // Skip non serializable attributes
                continue;
            }
            throw wae;
        }
        if (manager.getContext().getLogger().isDebugEnabled())
            manager.getContext().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<>();
    }

    if (notes == null) {
        notes = new Hashtable<>();
    }
}
 
Example 2
Source File: DeltaSession.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
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;
            }
            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();
    }
 
Example 3
Source File: StandardSession.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * 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) {
                // Skip non serializable attributes
                continue;
            }
            throw wae;
        }
        if (manager.getContainer().getLogger().isDebugEnabled())
            manager.getContainer().getLogger().debug("  loading attribute '" + name +
                "' with value '" + value + "'");
        attributes.put(name, value);
    }
    isValid = isValidSave;

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

    if (notes == null) {
        notes = new Hashtable<String, Object>();
    }
}
 
Example 4
Source File: DeltaSession.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
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();
    }
 
Example 5
Source File: StandardSession.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * 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>();
    }
}