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 176648 - Wrong test for: Entity bean home interface find[METHOD](...) matches ejbFind[METHOD]
Summary: Wrong test for: Entity bean home interface find[METHOD](...) matches ejbFind[...
Status: RESOLVED WONTFIX
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 normal (vote)
Assignee: Vince Kraemer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-12 04:30 UTC by cistox
Modified: 2011-11-16 16:41 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cistox 2009-11-12 04:30:33 UTC
This is the error obtained after a full verify of the enterprise application project:

	 --------------
	 FAILED TESTS : 
	 --------------
	
	 Test Name : tests.ejb.entity.findermethod.HomeInterfaceFindMethodMatch
	 Test Assertion : Entity bean home interface find[METHOD](...) matches ejbFind[METHOD](...).
	 Test Description : For [ CSIPortal#EJBWebProfile-ejb.jar#EJBWebDwnld ]
For home interface [ ejb.com.dbprofile.EJBWebDwnldHome ] method [ findByCustomerId ].
Error: A corresponding [ ejbFindByCustomerId ] method was found, but the parameters did not match.
---------------------------------------

Issue Explanation:
The error appears even if the following condition is satisfied in the code:

   Entity bean home interface find[METHOD](...) matches ejbFind[METHOD](...).

The verification test fails because I have two find methods with the same name and a different number of parameters.
Below I indicate the Class where the bug can be easely identified because the home methods are compared with the bean methods by matching their names but comparing then the wrong ones.  E.g. the verify test compares the findMethodA(P1) with the ejbFindMethodA(P1, P2) which is wrong.

The error is located in the following Class:

com.sun.enterprise.tools.verifier.tests.ejb.entity.findermethod.HomeInterfaceFindMethodMatch

Under the Method:

private void commonToBothInterfaces(String home, String remote, EjbDescriptor descriptor)

At the following instruction the compared parameters are not coming from the right methods:

  if (!Arrays.equals(methodParameterTypes,ejbFinderMethodParameterTypes)) {
     ...

Because the following test is not sufficient to start a compare of the home/beans method parameters:

  if (homeInterfaceMethods[i].getName().toUpperCase().equals                                    (ejbFinderMethods[z].getName().toUpperCase().substring(3))) {
   ...

This test is allowing a wrong comparation between 

findMethodA(P1) with the ejbFindMethodA(P1, P2)
findMethodA(P1, P2) with the ejbFindMethodA(P1)

instead of

findMethodA(P1) with the ejbFindMethodA(P1)
findMethodA(P1, P2) with the ejbFindMethodA(P1, P2)
Comment 1 Petr Jiricka 2009-11-12 06:23:03 UTC
I must say I don't fully understand, what are the steps to reproduce this in the IDE? Can you please attach a project which reproduces this?
Also, is this a bug in the verifier tool, or in the IDE?
Comment 2 Andrey Yamkovoy 2009-11-13 04:09:43 UTC
What is application server, version?
Comment 3 Andrey Yamkovoy 2009-11-13 04:40:01 UTC
The verifier support is implemented on the server plugin side.
Reassign for evaluation.
Comment 4 Vince Kraemer 2009-11-13 09:11:15 UTC
ok.

The problem is in the verifier. 

I have to assume that your application targets GF v1 or v2 or SJSAS 8.x.

The work-around is simple... change the name of one of the two methods so there is no possibility of the crisscrossed match.

something like

findByX (one param)
findByXAndY (two param)

You should probably file a bug at https://glassfish.dev.java.net/issues for the verifier

Since there is no code change which we can commit to the NB source code that will fix this issue, I am going to mark it as won't fix.

If you disagree with this resolution, please reopen the issue with details about how you used NetBeans to create the code that triggered the warning from the verifier.  For example... which wizard did you use to generate the bogus finder methods.