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.
Summary: | NullPointerException at org.netbeans.modules.ruby.railsprojects.GeneratorPanel.getSelectedGenerator | ||
---|---|---|---|
Product: | ruby | Reporter: | inetufo <inetufo> |
Component: | Rails | Assignee: | Erno Mononen <emononen> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | astroace1, camokatu, cybermind, deltakilo, inetufo, java7, jgedean, juantar, lastps, luishidalgo, markdavoren, mgkaiser, mschovanek, pjiricka, ptharso, rockerox, rrowland, saurabhp, sridher, talik, upiva |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://statistics.netbeans.org/exceptions/detail.do?id=130170 | ||
Issue Type: | DEFECT | Exception Reporter: | 130170 |
Bug Depends on: | |||
Bug Blocks: | 154624 | ||
Attachments: |
stacktrace
stacktrace |
Description
inetufo
2009-01-22 18:33:25 UTC
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. *** |