com.hazelcast.util
Class ExceptionUtil

java.lang.Object
  extended by com.hazelcast.util.ExceptionUtil

public final class ExceptionUtil
extends Object

Author:
mdogan 2/11/13

Method Summary
static void fixRemoteStackTrace(Throwable remoteCause, StackTraceElement[] localSideStackTrace)
          This method changes the given remote cause and adds the also given local stacktrace.
If the remoteCause is an ExecutionException and it has a non null inner cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the that instead of the given remoteCause itself.
static void fixRemoteStackTrace(Throwable remoteCause, StackTraceElement[] localSideStackTrace, String localExceptionMessage)
          This method changes the given remote cause and adds the also given local stacktrace separated by the supplied exception message.
If the remoteCause is an ExecutionException and it has a non null inner cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the that instead of the given remoteCause itself.
static RuntimeException rethrow(Throwable t)
           
static
<T extends Throwable>
RuntimeException
rethrow(Throwable t, Class<T> allowedType)
           
static
<T extends Throwable>
RuntimeException
rethrowAllowedTypeFirst(Throwable t, Class<T> allowedType)
          This rethrow the exception providing an allowed Exception in first priority, even it is a Runtime exception
static RuntimeException rethrowAllowInterrupted(Throwable t)
           
static
<T> T
sneakyThrow(Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rethrow

public static RuntimeException rethrow(Throwable t)

rethrow

public static <T extends Throwable> RuntimeException rethrow(Throwable t,
                                                             Class<T> allowedType)
                                throws T extends Throwable
Throws:
T extends Throwable

rethrowAllowedTypeFirst

public static <T extends Throwable> RuntimeException rethrowAllowedTypeFirst(Throwable t,
                                                                             Class<T> allowedType)
                                                throws T extends Throwable
This rethrow the exception providing an allowed Exception in first priority, even it is a Runtime exception

Throws:
T extends Throwable

rethrowAllowInterrupted

public static RuntimeException rethrowAllowInterrupted(Throwable t)
                                                throws InterruptedException
Throws:
InterruptedException

sneakyThrow

public static <T> T sneakyThrow(Throwable t)

fixRemoteStackTrace

public static void fixRemoteStackTrace(Throwable remoteCause,
                                       StackTraceElement[] localSideStackTrace)
This method changes the given remote cause and adds the also given local stacktrace.
If the remoteCause is an ExecutionException and it has a non null inner cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the that instead of the given remoteCause itself.

Parameters:
remoteCause - the remotely generated exception
localSideStackTrace - the local stacktrace to add to the exceptions stacktrace

fixRemoteStackTrace

public static void fixRemoteStackTrace(Throwable remoteCause,
                                       StackTraceElement[] localSideStackTrace,
                                       String localExceptionMessage)
This method changes the given remote cause and adds the also given local stacktrace separated by the supplied exception message.
If the remoteCause is an ExecutionException and it has a non null inner cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the that instead of the given remoteCause itself.

Parameters:
remoteCause - the remotely generated exception
localSideStackTrace - the local stacktrace to add to the exceptions stacktrace
localExceptionMessage - a special exception message which is added to the stacktrace


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.