net.sf.farrago.jdbc
Class FarragoJdbcUtil

java.lang.Object
  extended by net.sf.farrago.jdbc.FarragoJdbcUtil

public class FarragoJdbcUtil
extends Object

Utility functions for the Farrago JDBC driver.

This class is JDK 1.4 compatible.

Since:
Mar 18, 2006
Version:
$Id: //open/dev/farrago/src/net/sf/farrago/jdbc/FarragoJdbcUtil.java#17 $
Author:
angel

Nested Class Summary
static class FarragoJdbcUtil.FarragoSqlException
          Exception thrown by Farrago JDBC driver.
private static class FarragoJdbcUtil.SerializationChecker
          Tests whether an object (in particular an exception) is serializable.
 
Field Summary
private static ThreadLocal threadChecker
          Contains the serialization checker for each thread.
 
Constructor Summary
FarragoJdbcUtil()
           
 
Method Summary
static String findInputString(Throwable ex)
          Walks an exception stack using reflection looking for the original SQL statement that MAY be in the exception stack.
static SQLException newSqlException(String message, Logger tracer)
          Creates a new SQLException.
static SQLException newSqlException(Throwable ex, Logger tracer)
          Converts any Throwable to a SQLException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadChecker

private static final ThreadLocal threadChecker
Contains the serialization checker for each thread.

Constructor Detail

FarragoJdbcUtil

public FarragoJdbcUtil()
Method Detail

newSqlException

public static SQLException newSqlException(Throwable ex,
                                           Logger tracer)
Converts any Throwable to a SQLException.

Parameters:
ex - Throwable to be converted
tracer - Logger on which to trace exceptions as they are converted; must not be null
Returns:
ex as a SQLException

newSqlException

public static SQLException newSqlException(String message,
                                           Logger tracer)
Creates a new SQLException.

Parameters:
message - detail message, the reason for this exception
tracer - Logger on which to trace new exceptions; must not be null
Returns:
new SQLException

findInputString

public static String findInputString(Throwable ex)
Walks an exception stack using reflection looking for the original SQL statement that MAY be in the exception stack.

Parameters:
ex - top of exception stack
Returns:
Original input text that generated the error or null