use of java.io.InvalidObjectException in project Bytecoder by mirkosertic.
the class DirectoryIteratorException method readObject.
/**
* Called to read the object from a stream.
*
* @throws InvalidObjectException
* if the object is invalid or has a cause that is not
* an {@code IOException}
*/
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
Throwable cause = super.getCause();
if (!(cause instanceof IOException))
throw new InvalidObjectException("Cause must be an IOException");
}
use of java.io.InvalidObjectException in project spf4j by zolyfarkas.
the class ExportedValuesMBean method setAttribute.
/**
* {@inheritDoc}
*/
@Override
public void setAttribute(final Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException {
String name = attribute.getName();
ExportedValue<Object> result = (ExportedValue<Object>) exportedValues.get(name);
if (result == null) {
throw new AttributeNotFoundException(name);
}
try {
result.set(attribute.getValue());
} catch (InvalidObjectException | RuntimeException ex) {
LOG.warn("Exception while setting attr {}", attribute, ex);
throw new InvalidAttributeValueException("Invalid value " + attribute + " detail:\n" + Throwables.toString(ex));
}
}
use of java.io.InvalidObjectException in project streamsupport by stefan-zobel.
the class ColSer method ioe.
private static InvalidObjectException ioe(RuntimeException ex) {
InvalidObjectException ioe = new InvalidObjectException("invalid object");
ioe.initCause(ex);
return ioe;
}
use of java.io.InvalidObjectException in project accumulo by apache.
the class RangeTest method testReadFields_Check.
public void testReadFields_Check() throws Exception {
Range r = new Range(new Key(new Text("soup")), true, false, new Key(new Text("nuts")), true, false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
r.write(dos);
dos.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
Range r2 = new Range();
try (DataInputStream dis = new DataInputStream(bais)) {
r2.readFields(dis);
fail("readFields allowed invalid range");
} catch (InvalidObjectException exc) {
/* good! */
}
}
use of java.io.InvalidObjectException in project hudson-2.x by hudson.
the class SimpleScheduledRetentionStrategy method readResolve.
protected synchronized Object readResolve() throws ObjectStreamException {
try {
tabs = CronTabList.create(startTimeSpec);
lastChecked = new GregorianCalendar();
this.lastChecked.add(Calendar.MINUTE, -1);
nextStop = Long.MIN_VALUE;
nextStart = Long.MIN_VALUE;
lastStop = Long.MAX_VALUE;
lastStart = Long.MAX_VALUE;
} catch (ANTLRException e) {
InvalidObjectException x = new InvalidObjectException(e.getMessage());
x.initCause(e);
throw x;
}
return this;
}
Aggregations