This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248336 - NullPointerException at org.netbeans.modules.db.explorer.DatabaseConnection.hashCode
Summary: NullPointerException at org.netbeans.modules.db.explorer.DatabaseConnection.h...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2014-11-01 17:33 UTC by zlogic
Modified: 2015-02-02 02:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 213067


Attachments
stacktrace (838 bytes, text/plain)
2014-11-01 17:33 UTC, zlogic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zlogic 2014-11-01 17:33:47 UTC
Build: NetBeans IDE 8.0.1 (Build 201408251540)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.25-b02, Java(TM) SE Runtime Environment, 1.8.0_25-b18
OS: Windows 8

User Comments:
zlogic: Nothing




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.explorer.DatabaseConnection.hashCode(DatabaseConnection.java:1063)
   at java.util.WeakHashMap.hash(WeakHashMap.java:298)
   at java.util.WeakHashMap.put(WeakHashMap.java:449)
   at org.netbeans.modules.db.explorer.ConnectionList.fireListeners(ConnectionList.java:197)
   at org.netbeans.modules.db.explorer.ConnectionList.access$000(ConnectionList.java:72)
   at org.netbeans.modules.db.explorer.ConnectionList$1.resultChanged(ConnectionList.java:110)
Comment 1 zlogic 2014-11-01 17:33:49 UTC
Created attachment 150204 [details]
stacktrace
Comment 2 matthias42 2014-11-01 18:28:55 UTC
DatabaseConnection.java should use the Objects-Methods for hashCode generation.

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -1060,7 +1060,7 @@
 
     @Override
     public int hashCode() {
-        return drv.hashCode() + db.hashCode() + usr.hashCode();
+        return Objects.hashCode(drv) + Objects.hashCode(db) + Objects.hashCode(usr);
     }
 
     /** Compares two connections.
Comment 3 matthias42 2015-01-31 15:14:45 UTC
The fix was committed as:

http://hg.netbeans.org/core-main/rev/b7ea222e6159

In the next few days a nightly build will be available, that contains the fix. When this build is available, a message is placed here. Please try that build and check, that your problem is fixed. If you find it fixed, please change the status of this bug to "VERIFIED".
Comment 4 Quality Engineering 2015-02-02 02:44:26 UTC
Integrated into 'main-silver', will be available in build *201502020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b7ea222e6159
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #248336: Prevent NullPointer Exception in DatabaseConnection#hashCode by using java7 Objects.hashCode methods