code: static final void throwException(final Throwable t, final String message) throws SQLException {
        if(t != null) {
           if(t instanceof SQLException) {
              throw (SQLException)t;
           } else if(t instanceof Error) {
              throw (Error)t;
           } else if(t instanceof RuntimeException) {
              throw (RuntimeException)t;
           } else {
              if(message != null) {
                 throw new SQLException(message, t);
              } else {
                 throw new SQLException(t);
              }
           }
        }
     }
docs: Examine a <tt>Throwable</tt> to preserve <tt>RuntimeException</tt> and <tt>Error</tt>, otherwise throw a <tt>SQLException</tt>.
  @param t The exception. Ignored if <tt>null</tt>.
  @param message A message to be added to the <tt>SQLException</tt>.
  @throws java.sql.SQLException The exception.