本文整理匯總了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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.
}