details:   https://code.openbravo.com/erp/devel/pi/rev/1c1111f45555
changeset: 30303:1c1111f45555
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Sep 20 09:37:30 2016 +0200
summary:   fixed bug 34027: NPE in build process if db.queryTimeout.* is set

  This NPE was thrown because in build process a connection was tried to be
  obtained from DAL which is not available this throws an expection that is
  not logged but left a statement with null value that later was tried to be
  closed, throwing the NPE.

  Fixed by guarding null value of the statement before closing it.

diffstat:

 src/org/openbravo/service/db/QueryTimeOutUtil.java |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r f2d97e8bbe22 -r 1c1111f45555 
src/org/openbravo/service/db/QueryTimeOutUtil.java
--- a/src/org/openbravo/service/db/QueryTimeOutUtil.java        Tue Sep 20 
00:09:06 2016 +0000
+++ b/src/org/openbravo/service/db/QueryTimeOutUtil.java        Tue Sep 20 
09:37:30 2016 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -116,7 +116,9 @@
         canApplyTimeOut = false;
       } finally {
         try {
-          statement.close();
+          if (statement != null) {
+            statement.close();
+          }
         } catch (SQLException e) {
           log.warn("Statement.setQueryTimeout method not supported", e);
         }

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to