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 235734

Summary: NullPointerException at org.netbeans.modules.form.j2ee.QueryResultListCreator.getJavaCreationCode
Product: guibuilder Reporter: palman
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED FIXED    
Severity: normal Keywords: 7.4_HR_FIX
Priority: P1    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 203724
Attachments: stacktrace

Description palman 2013-09-10 07:18:27 UTC
Build: NetBeans IDE Dev (Build 201309060001)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b15
OS: Mac OS X

User Comments:
palman: custome creation of code




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.form.j2ee.QueryResultListCreator.getJavaCreationCode(QueryResultListCreator.java:139)
   at org.netbeans.modules.form.JavaCodeGenerator.generateComponentCreate(JavaCodeGenerator.java:1509)
   at org.netbeans.modules.form.JavaCodeGenerator.addCreateCode(JavaCodeGenerator.java:1164)
   at org.netbeans.modules.form.JavaCodeGenerator.regenerateInitComponents(JavaCodeGenerator.java:1016)
   at org.netbeans.modules.form.JavaCodeGenerator.regenerateCode(JavaCodeGenerator.java:3493)
   at org.netbeans.modules.form.RADComponent.rename(RADComponent.java:544)
Comment 1 palman 2013-09-10 07:18:29 UTC
Created attachment 139871 [details]
stacktrace
Comment 2 Tomas Pavek 2013-09-10 16:31:12 UTC
Caused accidentally in 7c190d9e604c by introducing new method parameters when one of them (propNames) now hides a field of the same name that was used so far, but now the parameter is used instead which is always null. (It's a shame there's no warning in java editor about this.) This makes the JPA-related components unusable, code generation always fails when there is any property set.

Fixed by making the field name different from the local parameter name, i.e. returning to previous correct behavior.

http://hg.netbeans.org/jet-main/rev/a3f28af28d8a
Comment 3 Tomas Pavek 2013-09-10 16:53:06 UTC
Can be tested simply by adding e.g. the 'Query' component from palette (Java Persistence category) to a form, setting the query property to anything and then switching the form to Source - which invoke code generation. It fails before this fix.
Comment 4 Tomas Pavek 2013-09-11 08:38:36 UTC
Transplanted to release74:
http://hg.netbeans.org/releases/rev/11d77bb7bf30