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.
Build: NetBeans IDE 6.5 (Build 200811100001) VM: Java HotSpot(TM) Client VM, 11.2-b01, Java(TM) SE Runtime Environment, 1.6.0_12-ea-b03 OS: Windows XP, 5.1, x86 User Comments: GUEST: When generate, I met java.lang.NullPointerException at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.getSelectedGenerator(GeneratorPanel.java:143) at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.isValid(GeneratorPanel.java:480) at java.awt.Component.invalidateIfValid(Component.java:2711) at java.awt.Component.setLocale(Component.java:1780) at javax.swing.JComponent.<init>(JComponent.java:600) at javax.swing.JPanel.<init>(JPanel.java:82) at javax.swing.JPanel.<init>(JPanel.java:109) at javax.swing.JPanel.<init>(JPanel.java:117) at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.<init>(GeneratorPanel.java:90) at org.netbeans.modules.ruby.railsprojects.GenerateAction.generate(GenerateAction.java:174) at org.netbeans.modules.ruby.railsprojects.GenerateAction.performAction(GenerateAction.java:153) at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:581) at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.actionPerf GUEST: generating error Stacktrace: java.lang.NullPointerException at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.getSelectedGenerator(GeneratorPanel.java:143) at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.isValid(GeneratorPanel.java:480) at java.awt.Component.invalidateIfValid(Component.java:2740) at java.awt.Component.setLocale(Component.java:1810) at javax.swing.JComponent.<init>(JComponent.java:595) at javax.swing.JPanel.<init>(JPanel.java:65)
Created attachment 76148 [details] stacktrace
Build: NetBeans IDE 6.5 (Build 200811100001) VM: Java HotSpot(TM) Client VM, 11.2-b01, Java(TM) SE Runtime Environment, 1.6.0_12-ea-b03 OS: Windows XP, 5.1, x86 User Comments: Stacktrace: java.lang.NullPointerException at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.getSelectedGenerator(GeneratorPanel.java:143) at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.isValid(GeneratorPanel.java:480) at java.awt.Component.invalidateIfValid(Component.java:2740) at java.awt.Component.setLocale(Component.java:1810) at javax.swing.JComponent.<init>(JComponent.java:595) at javax.swing.JPanel.<init>(JPanel.java:65)
Created attachment 76149 [details] stacktrace
Hopefully fixed now in 02c0e6eeb384. I wasn't able to reproduce, so the fix is a bit of a guess -- please reopen if you run into this again. At least it should now fail in a way that gives a better indication of the problem.
Integrated into 'main-golden', will be available in build *200902060201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/02c0e6eeb384 User: Erno Mononen <emononen@netbeans.org> Log: #157326: NullPointerException at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.getSelectedGenerator
Reopening - reproduced in NetBeans IDE Dev (Build 200902120201) http://statistics.netbeans.org/exceptions/detail.do?id=130170
I'm not a Java programmer, so take this with a grain of salt. It looks like getSelectedGenerator is being called before a generator has been selected. In which case typeCombo.getSelectedItem() is null and String item = typeCombo.getSelectedItem().toString(); will get a null pointer exception Looking at the stack trace, get SelectedGenerator is being called, indirectly, by GeneratorPanel's base base class constructor (JComponent) and hence before the GeneratorPanel object is properly initialized. I don't know if this is reasonable or not. I would suggest something like inserting the following before line 143 if (typeCombo.getSelectedItem() == null) { return Generator.NONE; } though I leave it to the Java experts to suitably optimize this. Mark.
Downgrading from JDK 1.6.0_12 to JDK 1.6.0_07 "fixes" the problem. I guess somewhere between 7 and 12 the call from the Jcomponent constructor to isValid was added. Mark.
Should fixed now in 14bd194a0d50.
Transplanted to release65_fixes as 2fc6e378a8a2.
v.
*** Issue 159584 has been marked as a duplicate of this issue. ***