java.io.NotActiveException源码实例Demo

java.io.ObjectInputValidation#java.io.NotActiveException源码实例Demo

下面列出了java.io.ObjectInputValidation#java.io.NotActiveException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk1.8-source-analysis   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码2 项目: jdk1.8-source-analysis   文件: InputStreamHook.java
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);
}
 
源代码3 项目: TencentKona-8   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码4 项目: TencentKona-8   文件: InputStreamHook.java
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);
}
 
源代码5 项目: jdk8u60   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码6 项目: jdk8u60   文件: InputStreamHook.java
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);
}
 
源代码7 项目: JDKSourceCode1.8   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码8 项目: JDKSourceCode1.8   文件: InputStreamHook.java
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);
}
 
源代码9 项目: openjdk-jdk8u   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码10 项目: openjdk-jdk8u   文件: InputStreamHook.java
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);
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: InputStreamHook.java
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);
}
 
源代码13 项目: openjdk-jdk9   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码14 项目: openjdk-jdk9   文件: InputStreamHook.java
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);
}
 
源代码15 项目: hottub   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码16 项目: hottub   文件: InputStreamHook.java
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);
}
 
源代码17 项目: openjdk-8-source   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码18 项目: openjdk-8-source   文件: InputStreamHook.java
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);
}
 
源代码19 项目: openjdk-8   文件: IIOPOutputStream.java
/**
 * 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);
    }
}
 
源代码20 项目: openjdk-8   文件: InputStreamHook.java
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);
}
 
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;
}
 
源代码22 项目: j2objc   文件: OldObjectOutputStreamTest.java
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());
}
 
源代码23 项目: jdk1.8-source-analysis   文件: OutputStreamHook.java
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
源代码24 项目: jdk1.8-source-analysis   文件: InputStreamHook.java
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}
 
源代码25 项目: TencentKona-8   文件: OutputStreamHook.java
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
源代码26 项目: TencentKona-8   文件: InputStreamHook.java
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}
 
源代码27 项目: jdk8u60   文件: OutputStreamHook.java
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
源代码28 项目: jdk8u60   文件: InputStreamHook.java
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}
 
源代码29 项目: JDKSourceCode1.8   文件: OutputStreamHook.java
public void writeFields()
    throws IOException {

    writeObjectState.defaultWriteObject(this);
    if (putFields != null) {
        putFields.write(this);
    } else {
        throw new NotActiveException("no current PutField object");
    }
}
 
源代码30 项目: JDKSourceCode1.8   文件: InputStreamHook.java
public void defaultReadObject()
    throws IOException, ClassNotFoundException, NotActiveException
{
    readObjectState.beginDefaultReadObject(this);

    defaultReadObjectDelegate();

    readObjectState.endDefaultReadObject(this);
}