From db822559ddabc2db2d7e2f5923f6976a0bfc3f29 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Sat, 6 Dec 2008 17:28:57 +0000 Subject: [PATCH] BF [ 2188252 ] Make Adempiere build using both jdk 5 and jdk 6 : hide Proxy layer when throwing exceptions --- base/src/org/compiere/db/StatementProxy.java | 10 +++++++++- base/src/org/compiere/util/DB.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/base/src/org/compiere/db/StatementProxy.java b/base/src/org/compiere/db/StatementProxy.java index ec3c28c507..e2ff4c3902 100644 --- a/base/src/org/compiere/db/StatementProxy.java +++ b/base/src/org/compiere/db/StatementProxy.java @@ -13,6 +13,7 @@ package org.compiere.db; import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Connection; import java.sql.ResultSet; @@ -94,7 +95,14 @@ public class StatementProxy implements InvocationHandler { } Method m = p_stmt.getClass().getMethod(name, method.getParameterTypes()); - return m.invoke(p_stmt, args); + try + { + return m.invoke(p_stmt, args); + } + catch (InvocationTargetException e) + { + throw DB.getSQLException(e); + } } /** diff --git a/base/src/org/compiere/util/DB.java b/base/src/org/compiere/util/DB.java index a34aab8a44..51a5842a64 100644 --- a/base/src/org/compiere/util/DB.java +++ b/base/src/org/compiere/util/DB.java @@ -1803,7 +1803,7 @@ public final class DB * @param e Exception * @return SQLException if found or provided exception elsewhere */ - private static Exception getSQLException(Exception e) + public static Exception getSQLException(Exception e) { Throwable e1 = e; while (e1 != null)