You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2024/10/28 13:51:38 UTC

(ofbiz-framework) 04/05: Improved: Fix some bugs SpotBugs reports (OFBIZ-12386)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 1bacac99e4b5cd2701c34c721fb42155cf90db00
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Mon Oct 28 12:25:31 2024 +0100

    Improved: Fix some bugs SpotBugs reports (OFBIZ-12386)
    
    After https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=33fc03fa10
    
    I thought the problem was fixed since it's excluded. But it was not because
    there was a typo (a trailing blank in
    <Bug pattern="SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR " />)
    
    So I fixed that, but to my surprise it still does not work, weird :/
    
    Fixes a possible NPE in DatabaseUtil::getTableNames
---
 .../src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
index d166a892b0..595cece9f3 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
@@ -1091,7 +1091,9 @@ public class DatabaseUtil {
             if (messages != null) messages.add(message);
         } finally {
             try {
-                tableSet.close();
+                if (tableSet != null) {
+                    tableSet.close();
+                }
             } catch (SQLException e) {
                 String message = "Unable to close ResultSet for table list, continuing anyway... Error was:" + e.toString();
                 Debug.logError(message, MODULE);