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 204261

Summary: NullPointerException at org.netbeans.modules.db.sql.editor.ui.actions.RunSQLAction.isActionEnabled
Product: db Reporter: gerzhedowich <gerzhedowich>
Component: SQL EditorAssignee: Jiri Rechtacek <jrechtacek>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P4    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 182316
Attachments: stacktrace

Description gerzhedowich 2011-10-26 09:26:26 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-7955-on-20110923)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03
OS: Windows 7

Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.db.sql.editor.ui.actions.RunSQLAction.isActionEnabled(RunSQLAction.java:115)
   at org.netbeans.modules.project.ui.actions.FileCommandAction.globalProvider(FileCommandAction.java:125)
   at org.netbeans.modules.project.ui.actions.FileCommandAction.refresh(FileCommandAction.java:82)
   at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.doRefresh(LookupSensitiveAction.java:193)
   at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.run(LookupSensitiveAction.java:228)
   at org.netbeans.modules.project.ui.actions.ProjectAction.run(ProjectAction.java:66)
Comment 1 gerzhedowich 2011-10-26 09:26:30 UTC
Created attachment 112446 [details]
stacktrace
Comment 2 Jiri Rechtacek 2011-10-26 13:40:42 UTC
Only once report from code what is called Milon-times, let's wait for me such reports...
Comment 3 matthias42 2013-03-23 16:12:34 UTC
Closing this as the offending code:

if (FileUtil.getMIMEType(d.getPrimaryFile()) != null   // Line 115
      && FileUtil.getMIMEType(d.getPrimaryFile()).equals("text/x-sql")) {

could only result in an nullpointer exception if the result of context.lookupAll(DataObject.class) contained null, that was assigned to d and the exception is the result. if there is an off by one failure in the exception it could also be FileUtil.getMIMEType(d.getPrimaryFile() switching from non-null to null. 

There was no further report for about 1.5 years.