com.aliasi.util
Class Exceptions

java.lang.Object
  extended by com.aliasi.util.Exceptions

public class Exceptions
extends Object

Static utility methods for handling exceptions.

Since:
LingPipe2.0
Version:
3.8.1
Author:
Bob Carpenter

Method Summary
static void finite(String name, double value)
          Throws an illegal argument exception if the specified value is not finite.
static void finiteNonNegative(String name, double value)
          Throws an illegal argument exception if the specified value is not finite and non-negative, using the specified variable name in the report.
static IllegalArgumentException toIllegalArgument(String msg, Throwable t)
          Convert the specified throwable to an illegal argument exception.
static IOException toIO(String msg, Throwable t)
          Convert the specified throwable to an I/O exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toIO

public static IOException toIO(String msg,
                               Throwable t)
Convert the specified throwable to an I/O exception. The returned exception's message consists of the specified message and the throwable's message and class name. The stack trace of the returned exception will be identical to that of the specified throwable.

Parameters:
msg - Message to include in result's message.
t - Throwable to use for message and stack trace.
Returns:
Exception constructed from inputs.

toIllegalArgument

public static IllegalArgumentException toIllegalArgument(String msg,
                                                         Throwable t)
Convert the specified throwable to an illegal argument exception. The returned exception's message consists of the specified message and the throwable's message and class name. The stack trace of the returned exception will be identical to that of the specified throwable.

Parameters:
msg - Message to include in result's message.
t - Throwable to use for message and stack trace.
Returns:
Exception constructed from inputs.

finiteNonNegative

public static void finiteNonNegative(String name,
                                     double value)
Throws an illegal argument exception if the specified value is not finite and non-negative, using the specified variable name in the report. Note that Double.NaN is not considered finite.

Parameters:
name - Name of variable to report.
value - Value to test.
Throws:
IllegalArgumentException - If the value is not finite and non-negative.

finite

public static void finite(String name,
                          double value)
Throws an illegal argument exception if the specified value is not finite. Note that Double.NaN is not considered finite.

Parameters:
name - Name of variable to report.
value - Value to test.
Throws:
IllegalArgumentException - If the value is not finite.