use of java.io.InvalidObjectException in project geode by apache.
the class OpenMethod method invokeWithOpenReturn.
Object invokeWithOpenReturn(Object obj, Object[] params) throws MBeanException, IllegalAccessException, InvocationTargetException {
final Object[] javaParams;
try {
javaParams = fromOpenParameters(params);
} catch (InvalidObjectException e) {
final String msg = methodName() + ": cannot convert parameters " + "from open values: " + e;
throw new MBeanException(e, msg);
}
final Object javaReturn = method.invoke(obj, javaParams);
try {
return returnTypeConverter.toOpenValue(javaReturn);
} catch (OpenDataException e) {
final String msg = methodName() + ": cannot convert return " + "value to open value: " + e;
throw new MBeanException(e, msg);
}
}
use of java.io.InvalidObjectException in project geode by apache.
the class TableConverter method fromNonNullOpenValue.
public Object fromNonNullOpenValue(Object openValue) throws InvalidObjectException {
final TabularData table = (TabularData) openValue;
final Collection<CompositeData> rows = (Collection<CompositeData>) table.values();
final Map<Object, Object> valueMap = sortedMap ? OpenTypeUtil.newSortedMap() : OpenTypeUtil.newMap();
for (CompositeData row : rows) {
final Object key = keyConverter.fromOpenValue(row.get("key"));
final Object value = valueConverter.fromOpenValue(row.get("value"));
if (valueMap.put(key, value) != null) {
final String msg = "Duplicate entry in TabularData: key=" + key;
throw new InvalidObjectException(msg);
}
}
return valueMap;
}
use of java.io.InvalidObjectException in project ignite by apache.
the class GridCacheContext method readResolve.
/**
* Reconstructs object on unmarshalling.
*
* @return Reconstructed object.
* @throws ObjectStreamException Thrown in case of unmarshalling error.
*/
protected Object readResolve() throws ObjectStreamException {
try {
IgniteBiTuple<String, String> t = stash.get();
IgniteKernal grid = IgnitionEx.localIgnite();
GridCacheAdapter<K, V> cache = grid.internalCache(t.get2());
if (cache == null)
throw new IllegalStateException("Failed to find cache for name: " + t.get2());
return cache.context();
} catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
} finally {
stash.remove();
}
}
use of java.io.InvalidObjectException in project ignite by apache.
the class GridCacheSemaphoreImpl method readResolve.
/**
* Reconstructs object on unmarshalling.
*
* @return Reconstructed object.
* @throws ObjectStreamException Thrown in case of unmarshalling error.
*/
private Object readResolve() throws ObjectStreamException {
try {
IgniteBiTuple<GridKernalContext, String> t = stash.get();
IgniteSemaphore sem = IgnitionEx.localIgnite().context().dataStructures().semaphore(t.get2(), 0, false, false);
if (sem == null)
throw new IllegalStateException("Semaphore was not found on deserialization: " + t.get2());
return sem;
} catch (IgniteCheckedException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
} finally {
stash.remove();
}
}
use of java.io.InvalidObjectException in project jdk8u_jdk by JetBrains.
the class SimpleDateFormat method readObject.
/**
* After reading an object from the input stream, the format
* pattern in the object is verified.
* <p>
* @exception InvalidObjectException if the pattern is invalid
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
try {
compiledPattern = compile(pattern);
} catch (Exception e) {
throw new InvalidObjectException("invalid pattern");
}
if (serialVersionOnStream < 1) {
// didn't have defaultCenturyStart field
initializeDefaultCentury();
} else {
// fill in dependent transient field
parseAmbiguousDatesAsAfter(defaultCenturyStart);
}
serialVersionOnStream = currentSerialVersion;
// If the deserialized object has a SimpleTimeZone, try
// to replace it with a ZoneInfo equivalent in order to
// be compatible with the SimpleTimeZone-based
// implementation as much as possible.
TimeZone tz = getTimeZone();
if (tz instanceof SimpleTimeZone) {
String id = tz.getID();
TimeZone zi = TimeZone.getTimeZone(id);
if (zi != null && zi.hasSameRules(tz) && zi.getID().equals(id)) {
setTimeZone(zi);
}
}
}
Aggregations