}
if (ex instanceof EntryExistsException) {
return new DuplicateKeyException(ex.getMessage(), ex);
}
if (ex instanceof EntryNotFoundException) {
return new DataRetrievalFailureException(ex.getMessage(), ex);
}
if (ex instanceof RegionExistsException) {
return new DataIntegrityViolationException(ex.getMessage(), ex);
}
}
if (ex instanceof CacheRuntimeException) {
if (ex instanceof CacheXmlException) {
return new GemfireSystemException(ex);
}
if (ex instanceof CancelException) {
// all cancellations go wrapped by this exception
return new GemfireCancellationException((CancelException) ex);
}
if (ex instanceof CqClosedException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof DiskAccessException) {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof EntryDestroyedException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof FailedSynchronizationException) {
return new PessimisticLockingFailureException(ex.getMessage(), ex);
}
if (ex instanceof IndexMaintenanceException) {
return new GemfireIndexException((IndexMaintenanceException) ex);
}
if (ex instanceof OperationAbortedException) {
// treat user exceptions first
if (ex instanceof CacheLoaderException) {
return new GemfireSystemException(ex);
}
if (ex instanceof CacheWriterException) {
return new GemfireSystemException(ex);
}
// the rest are treated as resource failures
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof PartitionedRegionDistributionException) {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof PartitionedRegionStorageException) {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof QueryExecutionTimeoutException) {
return new GemfireQueryException((QueryExecutionTimeoutException) ex);
}
if (ex instanceof RegionDestroyedException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
if (ex instanceof com.gemstone.gemfire.admin.RegionNotFoundException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
if (ex instanceof ResourceException) {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof RoleException) {
return new GemfireSystemException(ex);
}
if (ex instanceof StatisticsDisabledException) {
return new GemfireSystemException(ex);
}
if (ex instanceof SynchronizationCommitConflictException) {
return new PessimisticLockingFailureException(ex.getMessage(), ex);
}
}
if (ex instanceof CopyException) {
return new GemfireSystemException(ex);
}
if (ex instanceof com.gemstone.gemfire.cache.EntryNotFoundInRegion) {
return new DataRetrievalFailureException(ex.getMessage(), ex);
}
if (ex instanceof FunctionException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof GemFireCacheException) {