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 245800 - NullPointerException at org.netbeans.modules.db.explorer.dlg.AddTableColumnDialog.updateState
Summary: NullPointerException at org.netbeans.modules.db.explorer.dlg.AddTableColumnDi...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2014-07-18 12:31 UTC by Exceptions Reporter
Modified: 2015-02-07 05:40 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 210774


Attachments
stacktrace (614 bytes, text/plain)
2014-07-18 12:31 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2014-07-18 12:31:41 UTC
This bug was originally marked as duplicate of bug 230226, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.3.1 (Build 201306052037)
VM: Java HotSpot(TM) Client VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b17
OS: Windows 7

User Comments:
GUEST: I was trying to add a column into a table, even the 'Add column' button when I am busy creating a new table doesn't work.




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.explorer.dlg.AddTableColumnDialog.updateState(AddTableColumnDialog.java:503)
   at org.netbeans.modules.db.explorer.dlg.AddTableColumnDialog.setDescriptor(AddTableColumnDialog.java:587)
   at org.netbeans.modules.db.explorer.dlg.AddTableColumnDialog.showDialogAndCreate(AddTableColumnDialog.java:647)
   at org.netbeans.modules.db.explorer.action.AddColumnAction$1.run(AddColumnAction.java:87)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
Comment 1 Exceptions Reporter 2014-07-18 12:31:43 UTC
Created attachment 148137 [details]
stacktrace
Comment 2 matthias42 2014-10-05 13:36:33 UTC
It would be interesting to know the DB on which this was encountered - but none the less - the code relies an sizelesstypes and charactertypes to be non-null. So ensure that in AddTableColumnDialog.java:

# 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)
@@ -58,6 +58,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
@@ -152,9 +153,12 @@
 
         // Column type
 
-        sizelesstypes = (Collection<String>) spe.getProperties().get("SizelessTypes"); // NOI18N
-        charactertypes = (Collection<String>) spe.getProperties().get("CharacterTypes"); // NOI18N
+        Collection<String> sizelesstypesSpec = (Collection<String>) spe.getProperties().get("SizelessTypes"); // NOI18N
+        Collection<String> charactertypesSpec = (Collection<String>) spe.getProperties().get("CharacterTypes"); // NOI18N
 
+        sizelesstypes = sizelesstypesSpec != null ? sizelesstypesSpec : Collections.<String>emptyList();
+        charactertypes = charactertypesSpec != null ? charactertypesSpec : Collections.<String>emptyList();
+        
         Map<String, String> tmap = spe.getTypeMap();
         List<TypeElement> ttab = new ArrayList<TypeElement>(tmap.size());
         for (String key : tmap.keySet()) {
Comment 3 matthias42 2015-02-04 20:07:26 UTC
Fix committed as:

http://hg.netbeans.org/core-main/rev/6e9c9acafddf

If someone has been able to reproduce the problem, please recheck after the nightly build that contains this fix is done (a message will be appended here then). If you can confirm the fix, please change Status of this bug to VERIFIED.
Comment 4 Quality Engineering 2015-02-07 05:40:29 UTC
Integrated into 'main-silver', will be available in build *201502070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6e9c9acafddf
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #245800: Prevent null pointer exception by initializing collections to empty list