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 246317 - NullPointerException at org.netbeans.modules.db.explorer.node.IndexNodeProvider$IndexComparator.compare
Summary: NullPointerException at org.netbeans.modules.db.explorer.node.IndexNodeProvid...
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-08-07 03:56 UTC by jcrada
Modified: 2015-02-02 02:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 211135


Attachments
stacktrace (1.18 KB, text/plain)
2014-08-07 03:56 UTC, jcrada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcrada 2014-08-07 03:56:41 UTC
Build: NetBeans IDE 8.0 (Build 201403101706)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.11-b03, Java(TM) SE Runtime Environment, 1.8.0_11-b12
OS: Linux

User Comments:
jcrada: Retrieving data from Teradata database

jcrada: retrieving data from teradata database




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.explorer.node.IndexNodeProvider$IndexComparator.compare(IndexNodeProvider.java:138)
   at org.netbeans.modules.db.explorer.node.IndexNodeProvider$IndexComparator.compare(IndexNodeProvider.java:134)
   at java.util.TreeMap.compare(TreeMap.java:1291)
   at java.util.TreeMap.put(TreeMap.java:538)
   at java.util.TreeSet.add(TreeSet.java:255)
   at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
Comment 1 jcrada 2014-08-07 03:56:42 UTC
Created attachment 148583 [details]
stacktrace
Comment 2 matthias42 2014-11-23 16:49:40 UTC
Looks like the DB-metadata does not report an index name. This could be:

a) A bogus index (statistics entry, that was not marked as such) or
b) really an index without a name

I'll asume the second case. For that this should work:

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/matthias/NetBeansProjects/core-main
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: db/src/org/netbeans/modules/db/explorer/node/IndexNode.java
--- db/src/org/netbeans/modules/db/explorer/node/IndexNode.java
+++ db/src/org/netbeans/modules/db/explorer/node/IndexNode.java
@@ -104,7 +104,9 @@
                     new Action<Metadata>() {
                         public void run(Metadata metaData) {
                             Index index = indexHandle.resolve(metaData);
+                            if(index.getName() != null) {
                             name = index.getName();
+                            }
                             updateProperties(index);
                         }
                     }
Comment 3 matthias42 2015-01-31 16:21:13 UTC
The proposed fix was merged as:

http://hg.netbeans.org/core-main/rev/3529f2a36a40

In the next few days a nightly build will be available (a message is added here then). Please check if this fixes your problem. If so change the status of this bug to "VERIFIED".
Comment 4 Quality Engineering 2015-02-02 02:44:40 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/3529f2a36a40
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #246317: Prevent NullPointerException -- ensure that Index-Name is never null