java.io.NotSerializableException#initCause ( )源码实例Demo

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

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.msgNum = in.readInt();
  this.processorId = in.readInt();
  try {
    this.result = DataSerializer.readObject(in);
    byte flags = in.readByte();
    this.lastMsg = (flags & IS_LAST) != 0;
    if ((flags & HAS_TX_CHANGES) != 0) {
      this.txChanges = TXChanges.fromData(in);
    }
  }
  catch (Exception e) { // bug fix 40670
    // Seems odd to throw a NonSerializableEx when it has already been
    // serialized and we are failing because we can't deserialize.
    NotSerializableException ioEx = new NotSerializableException();
    ioEx.initCause(e);
    throw ioEx;
  }
}
 
源代码2 项目: jdk1.8-source-analysis   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码3 项目: jdk1.8-source-analysis   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  byte flags = this.lastMsg ? IS_LAST : 0;
  out.writeInt(this.msgNum);
  out.writeInt(this.processorId);
  
  //soubhik. fix for ticket 40670
  try {
    DataSerializer.writeObject(this.result, out);
    if (this.lastMsg) {
      super.finishTX(this.txMsg, this.sendTXChanges, true);
    }
    if (this.txChanges != null) {
      flags |= HAS_TX_CHANGES;
    }
    out.writeByte(flags);
    if (this.txChanges != null) {
      this.txChanges.toData(out);
    }
  } 
  catch(Exception ex) {
    if (ex instanceof CancelException) {
      throw new DistributedSystemDisconnectedException(ex);
    }
    NotSerializableException ioEx = new NotSerializableException(this.result
        .getClass().getName());
    ioEx.initCause(ex);
    throw ioEx;
  }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码6 项目: jdk8u-jdk   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码7 项目: j2objc   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码8 项目: jdk8u60   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码9 项目: jdk8u60   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码10 项目: hottub   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码11 项目: jdk-1.7-annotated   文件: CertPath.java
/**
 * Replaces the <code>CertPath</code> to be serialized with a
 * <code>CertPathRep</code> object.
 *
 * @return the <code>CertPathRep</code> to be serialized
 *
 * @throws ObjectStreamException if a <code>CertPathRep</code> object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码12 项目: jdk8u_jdk   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码13 项目: openjdk-jdk8u   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码15 项目: openjdk-jdk8u-backup   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码16 项目: jdk8u-dev-jdk   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码17 项目: jdk8u-jdk   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码18 项目: openjdk-jdk9   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码19 项目: hottub   文件: CertPath.java
/**
 * Returns a {@code CertPath} constructed from the type and data.
 *
 * @return the resolved {@code CertPath} object
 *
 * @throws ObjectStreamException if a {@code CertPath} could not
 * be constructed
 */
protected Object readResolve() throws ObjectStreamException {
    try {
        CertificateFactory cf = CertificateFactory.getInstance(type);
        return cf.generateCertPath(new ByteArrayInputStream(data));
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
源代码20 项目: Java8CN   文件: CertPath.java
/**
 * Replaces the {@code CertPath} to be serialized with a
 * {@code CertPathRep} object.
 *
 * @return the {@code CertPathRep} to be serialized
 *
 * @throws ObjectStreamException if a {@code CertPathRep} object
 * representing this certification path could not be created
 */
protected Object writeReplace() throws ObjectStreamException {
    try {
        return new CertPathRep(type, getEncoded());
    } catch (CertificateException ce) {
        NotSerializableException nse =
            new NotSerializableException
                ("java.security.cert.CertPath: " + type);
        nse.initCause(ce);
        throw nse;
    }
}
 
 同类方法