public static Object convert(Object value, Class type, Class javaType) throws SQLException{ try { if(javaType == null || value == null) return ValueObjectUtil.getDefaultValue(javaType); if(java.sql.Clob.class.isAssignableFrom(type)) { if(javaType == Clob.class) return value; // value = ValueExchange.getStringFromClob((Clob)value); } else if(java.sql.Blob.class.isAssignableFrom(type)) { if(javaType == Blob.class) return value; // value = ValueExchange.getStringFromBlob((Blob)value); } return ValueObjectUtil.typeCast(value, value.getClass(), javaType); } catch (NumberFormatException e) { throw new NestedSQLException(e); } catch (IllegalArgumentException e) { throw new NestedSQLException(e); } catch (NoSupportTypeCastException e) { throw new NestedSQLException(e); } catch (Exception e) { throw new NestedSQLException(e); } // return null; } public static Object getValueFromRS(ResultSet res, int i, int type,
/** * Constructor from java.sql.SQLException with added nested exception * @see java.sql.SQLException * @param reason - the reason for the exception * @param SQLState - the SQLState * @param cause - the cause of the exception */ public NestedSQLException(String reason, String SQLState, Throwable cause) { super(reason, SQLState); initCause(cause); }
if(e.getCause() != null && e.getCause() instanceof RowHandlerException) fileSegment.appendErrorMsg(SimpleStringUtil.formatException(e.getCause()));//只记录最后一个异常 throw (RowHandlerException)e.getCause(); fileSegment.appendErrorMsg(SimpleStringUtil.formatException(e.getCause()));//只记录最后一个异常 else if(e.getCause() != null && e.getCause() instanceof ForceStopException) throw (ForceStopException)e.getCause(); fileSegment.appendErrorMsg(SimpleStringUtil.formatException(e.getCause() == null?e:e.getCause())); throw e; fileSegment.appendErrorMsg(SimpleStringUtil.formatException(e.getCause() == null?e:e.getCause()));//只记录最后一个异常
Throwable innere = e.getCause(); if(innere == null)
/** * Begins the actual database operation by preparing resources. It calls * doJDBC() to perform the actual operation. */ public Record[] executeSql(String dbname, String sql,Connection con) throws SQLException { Record[] hashResults = null; try { hashResults = doJDBC(dbname, sql,con); } catch (SQLException e) { throw e; } catch (Exception e) { throw new NestedSQLException(e); } finally { } return hashResults; }
/** * Constructor from java.sql.SQLException with added nested exception * @param msg - the message for the exception * @param cause - the cause of the exception */ public NestedSQLException(String msg, Throwable cause) { super(msg); initCause(cause); }
Throwable innere = e.getCause(); if(innere == null)
throw new NestedSQLException(e); } catch (Exception e) { throw new NestedSQLException(e);
/** * Constructor from java.sql.SQLException with added nested exception * @param cause - the cause of the exception */ public NestedSQLException(Throwable cause) { super(); initCause(cause); } }
throw new NestedSQLException(e); } finally { try {
/** * Constructor from java.sql.SQLException with added nested exception * @param reason - the reason for the exception * @param SQLState - the SQLState * @param vendorCode - a vendor supplied code to go w/ the message * @param cause - the cause of the exception */ public NestedSQLException(String reason, String SQLState, int vendorCode, Throwable cause) { super(reason, SQLState, vendorCode); initCause(cause); }
throw new NestedSQLException(e.getMessage(),e);
throw new NestedSQLException(e); } catch (IOException e) { throw new NestedSQLException(e);
throw new NestedSQLException(e); } finally { try {
throw new NestedSQLException(e);
}catch (Exception e) { throw new NestedSQLException(e); throw e; }catch (Exception e) { throw new NestedSQLException(e);
throw new NestedSQLException(e); } catch (IOException e) { throw new NestedSQLException(e);
throw new NestedSQLException(e); } finally { if (in != null) {
throw new NestedSQLException(e); } finally { try
throw new NestedSQLException(e); } finally { if (in != null) {