Top Description Constructors Methods
org.apache.poi.util

public Class ExceptionUtil

extends Object
Class Inheritance

Utility methods for dealing with exceptions/throwables
Since
POI 5.2.4

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

whether the Throwable is a fatal error
isFatal
(Throwable
to check
throwable
)

It is important never to catch all Throwables.

public static void
rethrow(Throwable
to check
throwable
)

Designed to be used in conjunction with isFatal(Throwable).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ExceptionUtilback to summary
private ExceptionUtil()

Method Detail

isFatalback to summary
public static boolean isFatal(Throwable throwable)

It is important never to catch all Throwables. Some like InterruptedException should be rethrown. Based on scala.util.control.NonFatal.

Parameters
throwable:Throwable

to check

Returns:boolean

whether the Throwable is a fatal error

rethrowback to summary
public static void rethrow(Throwable throwable) throws Error, RuntimeException

Designed to be used in conjunction with isFatal(Throwable). This method should be used with care.

The input throwable is thrown if it is an Error or a RuntimeException. Otherwise, the method wraps the throwable in a RuntimeException and rethrows that.

Parameters
throwable:Throwable

to check

Exceptions
Error:
the input throwable if it is an Error.
RuntimeException:
the input throwable if it is an RuntimeException Otherwise wraps the throwable in a RuntimeException.