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 57788 - NPE when cal "Call EJB"
Summary: NPE when cal "Call EJB"
Status: CLOSED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: EJB Freeform (show other bugs)
Version: 4.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-12 17:41 UTC by Petr Blaha
Modified: 2006-03-24 13:16 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace (162.40 KB, text/plain)
2005-04-12 17:44 UTC, Petr Blaha
Details
Proposed patch (1.48 KB, text/plain)
2005-04-12 21:40 UTC, Martin Adamek
Details
cmp2 sample (237.69 KB, application/x-gzip)
2005-04-14 09:07 UTC, Petr Blaha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2005-04-12 17:41:47 UTC
[Build 20050411 netbeans41 branch]
Steps:
1) create new Free-form project
2) open one entity bean impl class in editor
3) invoke enterprise resource | Use database
ERROR: get java.lang.NullPointerException
        at
org.netbeans.modules.j2ee.ejbjarproject.ui.logicalview.ejb.dnd.EjbReference.populateReference(EjbReference.java:100)
Comment 1 Petr Blaha 2005-04-12 17:44:02 UTC
Created attachment 21582 [details]
stack trace
Comment 2 Martin Adamek 2005-04-12 21:40:47 UTC
Created attachment 21584 [details]
Proposed patch
Comment 3 Martin Adamek 2005-04-12 21:47:42 UTC
Problem occures only when freeform doesn't specify client jar target. Of course
it is not needed, because in freeform one can call only its own EJBs. This check
was performed when bean was asked to generate reference and name of this
reference was used for comparing with set of existing resources. Anyway, there
is issue 57021 pointing to missing validations in Call EJB dialog, it means
checked reference name was compared to empty set.
Proposed patch only removes this check for reference name. There is zero user
impact, because checked name was compared to empty set :-)
Comment 4 Pavel Buzek 2005-04-12 22:17:57 UTC
I agree with the proposed patch as a hotfix for this problem (the NPE).

As I understand the patch removes problematic code that causes the NPE. The code
was supposed to prevent creation of multiple references for the same ejb, but
this code was not effective anyway - even now there are multiple references
created, even in 'standard' ejb project. This is not big issue and should be
resolved separately.
Comment 6 Petr Blaha 2005-04-13 07:12:05 UTC
Verified in continual trunk build 20050412-2226
Comment 8 Petr Blaha 2005-04-14 09:06:47 UTC
I am able to reproduce the issue in daily build 20050413, netbeans41 branch.
My steps:
1) import Freeform project(cmp2 project)
2) create new session bean
3) open bean class in editor
4) invoke Enterprise respource | Call EJB
5) select one Entity bean
6) specify JNDI name
7) click OK button
ERROR: java.lang.NullPointerException
	at
org.netbeans.modules.j2ee.ejbjarproject.ui.logicalview.ejb.dnd.EjbReference.populateReference(EjbReference.java:100)
	
Comment 9 Petr Blaha 2005-04-14 09:07:42 UTC
Created attachment 21632 [details]
cmp2 sample
Comment 10 Andrei Badea 2005-04-14 13:27:02 UTC
I will look at this.
Comment 11 Andrei Badea 2005-04-14 15:46:25 UTC
Again, it is caused by the freeform project not specifying output jars. The
proposed fix is to workaround this case by assuming that a bean from the current
project is called is the output is not set (we only support calling beans from
the current project in the EJB freeform project anyway).
Comment 12 Andrei Badea 2005-04-14 15:56:31 UTC
Checking in
src/org/netbeans/modules/j2ee/ejbjarproject/EnterpriseReferenceContainerImpl.java;
/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EnterpriseReferenceContainerImpl.java,v
 <--  EnterpriseReferenceContainerImpl.java
new revision: 1.13; previous revision: 1.12
done
Checking in
src/org/netbeans/modules/j2ee/ejbjarproject/ui/logicalview/ejb/dnd/EjbReference.java;
/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/ui/logicalview/ejb/dnd/EjbReference.java,v
 <--  EjbReference.java
new revision: 1.9; previous revision: 1.8
done
Comment 14 Pavel Buzek 2005-04-15 03:06:47 UTC
I reviewed the code (again) and tested and I agree with the fix.
Comment 15 Petr Blaha 2005-04-15 09:40:29 UTC
Verified and tested in trunk, build 20050414
Comment 16 Andrei Badea 2005-04-15 13:05:03 UTC
Fixed in the release41 branch:

Checking in
src/org/netbeans/modules/j2ee/ejbjarproject/EnterpriseReferenceContainerImpl.java;
/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EnterpriseReferenceContainerImpl.java,v
 <--  EnterpriseReferenceContainerImpl.java
new revision: 1.11.2.2; previous revision: 1.11.2.1
done
Checking in
src/org/netbeans/modules/j2ee/ejbjarproject/ui/logicalview/ejb/dnd/EjbReference.java;
/cvs/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/ui/logicalview/ejb/dnd/EjbReference.java,v
 <--  EjbReference.java
new revision: 1.8.4.1; previous revision: 1.8
done
Comment 17 Petr Blaha 2005-04-18 10:29:18 UTC
[Build netbeans41 RC1]