Search in sources :

Example 11 with SerializationException

use of org.apache.geode.SerializationException in project geode by apache.

the class AbstractBaseController method getValue.

protected <T> T getValue(final String regionNamePath, final Object key, boolean postProcess) {
    Assert.notNull(key, "The Cache Region key to read the value for cannot be null!");
    Region r = getRegion(regionNamePath);
    try {
        Object value = r.get(key);
        if (postProcess) {
            return (T) securityService.postProcess(regionNamePath, key, value, false);
        } else {
            return (T) value;
        }
    } catch (SerializationException se) {
        throw new DataTypeNotSupportedException("The resource identified could not convert into the supported content characteristics (JSON)!", se);
    } catch (NullPointerException npe) {
        throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow null keys!", regionNamePath), npe);
    } catch (IllegalArgumentException iae) {
        throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow requested operation on specified key!", regionNamePath), iae);
    } catch (LeaseExpiredException lee) {
        throw new GemfireRestException("Server has encountered error while processing this request!", lee);
    } catch (TimeoutException te) {
        throw new GemfireRestException("Server has encountered timeout error while processing this request!", te);
    } catch (CacheLoaderException cle) {
        throw new GemfireRestException("Server has encountered CacheLoader error while processing this request!", cle);
    } catch (PartitionedRegionStorageException prse) {
        throw new GemfireRestException("CacheLoader could not be invoked on partitioned region!", prse);
    }
}
Also used : GemfireRestException(org.apache.geode.rest.internal.web.exception.GemfireRestException) SerializationException(org.apache.geode.SerializationException) LeaseExpiredException(org.apache.geode.distributed.LeaseExpiredException) DataTypeNotSupportedException(org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException) PartitionedRegionStorageException(org.apache.geode.cache.PartitionedRegionStorageException) CacheLoaderException(org.apache.geode.cache.CacheLoaderException) Region(org.apache.geode.cache.Region) JSONObject(org.json.JSONObject) TimeoutException(org.apache.geode.cache.TimeoutException)

Aggregations

SerializationException (org.apache.geode.SerializationException)11 IOException (java.io.IOException)7 EOFException (java.io.EOFException)5 NotSerializableException (java.io.NotSerializableException)4 UTFDataFormatException (java.io.UTFDataFormatException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 CancelException (org.apache.geode.CancelException)4 GemFireIOException (org.apache.geode.GemFireIOException)4 ToDataException (org.apache.geode.ToDataException)4 CacheClosedException (org.apache.geode.cache.CacheClosedException)4 NonPortableClassException (org.apache.geode.pdx.NonPortableClassException)4 ObjectStreamClass (java.io.ObjectStreamClass)3 DataSerializable (org.apache.geode.DataSerializable)3 HeapDataOutputStream (org.apache.geode.internal.HeapDataOutputStream)3 Constructor (java.lang.reflect.Constructor)2 CacheLoaderException (org.apache.geode.cache.CacheLoaderException)2 Region (org.apache.geode.cache.Region)2 Version (org.apache.geode.internal.Version)2 DataTypeNotSupportedException (org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException)2 JSONObject (org.json.JSONObject)2