java.io.NotActiveException Java Examples

The following examples show how to use java.io.NotActiveException. 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: InputStreamHook.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #2
Source File: IIOPOutputStream.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #3
Source File: OldObjectOutputStreamTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void test_putFields() throws Exception {
    /*
     * "SerializableTestHelper" is an object created for these tests with
     * two fields (Strings) and simple implementations of readObject and
     * writeObject which simply read and write the first field but not the
     * second one.
     */
    SerializableTestHelper sth;

    try {
        oos.putFields();
        fail("Test 1: NotActiveException expected.");
    } catch (NotActiveException e) {
        // Expected.
    }

    oos.writeObject(new SerializableTestHelper("Gabba", "Jabba"));
    oos.flush();
    ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
    sth = (SerializableTestHelper) (ois.readObject());
    assertEquals("Test 2: readFields or writeFields failed; first field not set.",
            "Gabba", sth.getText1());
    assertNull("Test 3: readFields or writeFields failed; second field should not have been set.",
            sth.getText2());
}
 
Example #4
Source File: IIOPOutputStream.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #5
Source File: InputStreamHook.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #6
Source File: InputStreamHook.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #7
Source File: IIOPOutputStream.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #8
Source File: SecureWebSocketConfiguration.java    From red5-websocket with Apache License 2.0 6 votes vote down vote up
public SslFilter getSslFilter() throws Exception {
    if (keystoreFile == null || truststoreFile == null) {
        throw new NotActiveException("Keystore or truststore are null");
    }
    SSLContext context = getSslContext();
    if (context == null) {
        throw new NotActiveException("SSLContext is null");
    }
    // create the ssl filter using server mode
    SslFilter sslFilter = new SslFilter(context);
    if (cipherSuites != null) {
        sslFilter.setEnabledCipherSuites(cipherSuites);
    }
    if (protocols != null) {
        if (log.isDebugEnabled()) {
            log.debug("Using these protocols: {}", Arrays.toString(protocols));
        }
        sslFilter.setEnabledProtocols(protocols);
    }
    return sslFilter;
}
 
Example #9
Source File: InputStreamHook.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #10
Source File: InputStreamHook.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #11
Source File: IIOPOutputStream.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #12
Source File: IIOPOutputStream.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #13
Source File: IIOPOutputStream.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #14
Source File: InputStreamHook.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #15
Source File: InputStreamHook.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #16
Source File: IIOPOutputStream.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #17
Source File: IIOPOutputStream.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #18
Source File: InputStreamHook.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #19
Source File: InputStreamHook.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #20
Source File: IIOPOutputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #21
Source File: InputStreamHook.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ObjectInputStream.GetField readFields()
    throws IOException, ClassNotFoundException, NotActiveException {

    HashMap fieldValueMap = new HashMap();

    // We were treating readFields same as defaultReadObject. It is
    // incorrect if the state is readOptionalData. If this line
    // is uncommented, it will throw a stream corrupted exception.
    // _REVISIT_: The ideal fix would be to add a new state. In
    // writeObject user may do one of the following
    // 1. Call defaultWriteObject()
    // 2. Put out optional fields
    // 3. Call writeFields
    // We have the state defined for (1) and (2) but not for (3), so
    // we should ideally introduce a new state for 3 and have the
    // beginDefaultReadObject do nothing.
    //readObjectState.beginDefaultReadObject(this);

    readFields(fieldValueMap);

    readObjectState.endDefaultReadObject(this);

    return new HookGetFields(fieldValueMap);
}
 
Example #22
Source File: IIOPOutputStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the actions of the final method "defaultWriteObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void defaultWriteObjectDelegate()
/* throws IOException */
{
    try {
        if (currentObject == null || currentClassDesc == null)
            // XXX I18N, Logging needed.
            throw new NotActiveException("defaultWriteObjectDelegate");

        ObjectStreamField[] fields =
            currentClassDesc.getFieldsNoCopy();
        if (fields.length > 0) {
            outputClassFields(currentObject, currentClassDesc.forClass(),
                              fields);
        }
    } catch(IOException ioe) {
        bridge.throwException(ioe);
    }
}
 
Example #23
Source File: InputStreamHook.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}
 
Example #24
Source File: OptimizedObjectOutputStream.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void defaultWriteObject() throws IOException {
    if (curObj == null)
        throw new NotActiveException("Not in writeObject() call.");

    writeFields(curObj, curFields);
}
 
Example #25
Source File: InputStreamHook.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}
 
Example #26
Source File: OutputStreamHook.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
Example #27
Source File: UtilityService_s.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
private void handleDocumentTemplateRequest(Operation op) {
    if (op.getAction() != Action.GET) {
        op.fail(new NotActiveException());
        return;
    }
    ServiceDocument template = this.parent.getDocumentTemplate();
    String serializedTemplate = Utils.toJsonHtml(template);
    op.setBody(serializedTemplate).complete();
}
 
Example #28
Source File: OutputStreamHook.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
Example #29
Source File: UtilityService_t.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
private void handleDocumentTemplateRequest(Operation op) {
    if (op.getAction() != Action.GET) {
        op.fail(new NotActiveException());
        return;
    }
    ServiceDocument template = this.parent.getDocumentTemplate();
    String serializedTemplate = Utils.toJsonHtml(template);
    op.setBody(serializedTemplate).complete();
}
 
Example #30
Source File: OutputStreamHook.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}