BF [ 2188252 ] Make Adempiere build using both jdk 5 and jdk 6 : hide Proxy layer when throwing exceptions
This commit is contained in:
parent
fa599909a2
commit
d5211c0da4
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
@ -937,6 +937,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
e = getSQLException(e);
|
||||||
if (ignoreError)
|
if (ignoreError)
|
||||||
log.log(Level.SEVERE, cs.getSql() + " [" + trxName + "] - " + e.getMessage());
|
log.log(Level.SEVERE, cs.getSql() + " [" + trxName + "] - " + e.getMessage());
|
||||||
else
|
else
|
||||||
|
@ -1116,19 +1117,11 @@ public final class DB
|
||||||
*/
|
*/
|
||||||
public static RowSet getRowSet (String sql)
|
public static RowSet getRowSet (String sql)
|
||||||
{
|
{
|
||||||
RowSet retValue = null;
|
// Bugfix Gunther Hoppe, 02.09.2005, vpj-cd e-evolution
|
||||||
// Bugfix Gunther Hoppe, 02.09.2005 add vpj-cd e-evolution
|
|
||||||
// Begin
|
|
||||||
// CStatementVO info = new CStatementVO (
|
|
||||||
// RowSet.TYPE_SCROLL_INSENSITIVE, RowSet.CONCUR_READ_ONLY, sql);
|
|
||||||
CStatementVO info = new CStatementVO (RowSet.TYPE_SCROLL_INSENSITIVE, RowSet.CONCUR_READ_ONLY, DB.getDatabase().convertStatement(sql));
|
CStatementVO info = new CStatementVO (RowSet.TYPE_SCROLL_INSENSITIVE, RowSet.CONCUR_READ_ONLY, DB.getDatabase().convertStatement(sql));
|
||||||
// End add vpj-cd e-evolution
|
|
||||||
CPreparedStatement stmt = ProxyFactory.newCPreparedStatement(info);
|
CPreparedStatement stmt = ProxyFactory.newCPreparedStatement(info);
|
||||||
retValue = stmt.getRowSet();
|
RowSet retValue = stmt.getRowSet();
|
||||||
try {
|
close(stmt);
|
||||||
stmt.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
}
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getRowSet
|
} // getRowSet
|
||||||
|
|
||||||
|
@ -1156,7 +1149,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, getSQLException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1204,7 +1197,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, getSQLException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1252,7 +1245,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, getSQLException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1300,7 +1293,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, getSQLException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1376,7 +1369,7 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, getSQLException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1442,12 +1435,12 @@ public final class DB
|
||||||
}
|
}
|
||||||
catch (Exception ee)
|
catch (Exception ee)
|
||||||
{
|
{
|
||||||
|
ee = getSQLException(ee);
|
||||||
log.log(Level.FINEST, sql + " - " + e.getMessage(), ee);
|
log.log(Level.FINEST, sql + " - " + e.getMessage(), ee);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
close(rs2);
|
close(rs2, pstmt2);
|
||||||
close(pstmt2);
|
|
||||||
rs= null;
|
rs= null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
@ -1805,6 +1798,23 @@ public final class DB
|
||||||
rs.close();
|
rs.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to get the SQLException from Exception
|
||||||
|
* @param e Exception
|
||||||
|
* @return SQLException if found or provided exception elsewhere
|
||||||
|
*/
|
||||||
|
private static Exception getSQLException(Exception e)
|
||||||
|
{
|
||||||
|
Throwable e1 = e;
|
||||||
|
while (e1 != null)
|
||||||
|
{
|
||||||
|
if (e1 instanceof SQLException)
|
||||||
|
return (SQLException)e1;
|
||||||
|
e1 = e1.getCause();
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
/** Quote */
|
/** Quote */
|
||||||
private static final char QUOTE = '\'';
|
private static final char QUOTE = '\'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue