當前位置: 首頁>>代碼示例>>Java>>正文


Java NotSerializableException.initCause方法代碼示例

本文整理匯總了Java中java.io.NotSerializableException.initCause方法的典型用法代碼示例。如果您正苦於以下問題:Java NotSerializableException.initCause方法的具體用法?Java NotSerializableException.initCause怎麽用?Java NotSerializableException.initCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.NotSerializableException的用法示例。


在下文中一共展示了NotSerializableException.initCause方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromData

import java.io.NotSerializableException; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.msgNum = in.readInt();
  this.lastMsg = in.readBoolean();
  this.processorId = in.readInt();
  try {
    this.result = DataSerializer.readObject(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;
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:17,代碼來源:FunctionStreamingReplyMessage.java

示例2: toData

import java.io.NotSerializableException; //導入方法依賴的package包/類
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  out.writeInt(this.msgNum);
  out.writeBoolean(this.lastMsg);
  out.writeInt(this.processorId);

  // soubhik. fix for ticket 40670
  try {
    DataSerializer.writeObject(this.result, 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;
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:21,代碼來源:FunctionStreamingReplyMessage.java

示例3: writeReplace

import java.io.NotSerializableException; //導入方法依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:CertPath.java

示例4: readResolve

import java.io.NotSerializableException; //導入方法依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:CertPath.java

示例5: rethrowDeserializationException

import java.io.NotSerializableException; //導入方法依賴的package包/類
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        NotSerializableException nse = new NotSerializableException();
        nse.initCause(ioe);
        throw nse; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    }

    // Not serialization problem, return.
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:RMIConnector.java


注:本文中的java.io.NotSerializableException.initCause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。