本文整理汇总了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.
}