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 56873 - Names duplicity not checked in J2EE wizards
Summary: Names duplicity not checked in J2EE wizards
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: martin_adamek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-23 14:42 UTC by Jiri Kopsa
Modified: 2016-07-07 08:55 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kopsa 2005-03-23 14:42:12 UTC
<note>
Assigning this to Peter J. to decide what we will/can do. CCing Peter W. to
comment on WS stuff. CCing also docs since this involves UI.
</note>

Currently, the new File wizards (incl. new Java Class and related) are checking
the duplicity of the filename/package. We should do the same in J2EE wizards. I
should note that this behaviour is not mentioned in the UI specs.

Current state of J2EE wizards leads to unexpected behaviour or broken source.
Here's a quick summary of the behaviour, when an existing name/package is entered:

Session Bean (and probably other Beans as well)
* it has unexpected behaviour
- a number is appended to the ejb name as well as to the class names when the
wizard is closed, the user is not notified in anyway about the duplicity nor the
"renaming behind the scenes"
PROPOSAL: Let's provide an error message in the wizard if:
- the ejb name or display name is duplicate
- the files that would be generated already exist

CMP Beans from Database
PROPOSAL: Should check the conditions for each Entity Bean individualy. If there
is a conflict, the bean should not be generated. In the end, the user would be
provided with a list of "duplicate beans".

Web Service
* it's breaking the source
- a number is appended to the class names BUT NOT TO THE:
	- ejb-name
	- webservice-description-name (shown in Project View)
	- nor to the *-mapping.xml and *.wsdl files
* this results in duplicate records in ejb-jar.xml (and probably corrupts other
xmls)
* it seems that this bug basically destroys the old web service
PROPOSAL: Provide same validation as for Session Beans.

Web Service Client (this needs a lot of answers)
- The Service Display Name is used from registry
- It seems that if the package name is empty, the package name is generated from
the name of the web service behind the scenes.
- Is there a problem with adding a client from one WSDL/URL twice? (it seems
there's no use case for it)
- How exactly does it work? what is affected?
- How does the issue relate to Web Service Registry (when a WS is being added
twice)?
PROPOSAL:
* A package name might be created based on the information from the WSDL
* The duplicity/file conflicts should be checked
Comment 1 Lukas Jungmann 2005-03-23 15:01:08 UTC
websvc wizard in build 200503221900:
 user isn't allowed to finnish the New Web Service wizard, if there's name clash
with other component in the module (servlet, other websvc,...); message is shown
at the bottom of the wizard (see issue #54686 for more details)


Comment 2 Petr Jiricka 2005-03-23 19:19:55 UTC
Sounds reasonable at first glance, assigning to Martin Adamek.
Comment 3 Rochelle Raccah 2005-03-23 19:24:04 UTC
The CMP from Database is a bit complicated because the user picks a bunch of
tables and never seens the bean names.  Furthermore, even beans for tables not
explicitly chosen by the user, but related to those chosen by the user are
generated.  So, if there are tables:
A
B
C
And the user chooses bean A, but B is related, and there is a bean B, there will
be this problem.  And, what is the user supposed to do?  There is no chance to
skip related beans or choose another name...
Comment 4 _ pcw 2005-03-23 19:57:28 UTC
> Web Service Client
> The Service Display Name is used from registry
The wizard extracts the genuine service name from the WSDL file and attempts to
match it against the service name in the registry.  The match is actually case
insenstive due to registry internals.  Best way to fix holes in matching is to
upgrade registry module to persist the orginal WSDL (not possible in 4.1).

> It seems that if the package name is empty, the package name is generated from
the name of the web service behind the scenes.

I don't understand this.  This is true for the client jar generated by the
registry but this jar is only used internally inside NetBeans, never in the
user's code.  The wizard forces the user to specify a package.  I do think we
should have the wizard suggest a default package name that is unique per wsdl
name, e.g. something like "client.[normalized wsdl name]"

> Is there a problem with adding a client from one WSDL/URL twice? (it seems
there's no use case for it)

It is allowed.  It could easily be prevented.  The effect is as if the user
replaced whatever services were in the old wsdl file with those in the new one.
 We should probably issue a warning on this at least, if not an outright error.
 But it will only cause a problem if the user didn't want to upgrade or change
the older wsdl file (which likely, but not necessarily is related to the new one.)

- How does the issue relate to Web Service Registry (when a WS is being added
twice)?

Does this refer to the fact that it is possible to get two entries in the
registry with the same name?  This is a more difficult problem.  Unless the
registry entries are actually different services, this will never cause a
problem.  But if they are, unfortunately, there is no easy way to distinguish
them (related to registry throwing away the orginal wsdl files when the services
were added.)

PROPOSAL:
* A package name might be created based on the information from the WSDL
Agreed.
* The duplicity/file conflicts should be checked
Agreed.

Comment 5 _ pcw 2005-03-23 20:04:21 UTC
Regarding web service wizard.  The numbers are an artifact of the java target
chooser being used -- I don't know what can or should be done about those except
to not use the target chooser and have better contraints.

Is the name checking code successfully preventing the deployment descriptor
collisions, or are there edge cases I missed?  (I'm not aware of any).

In case someone asks about somehow syncing numbering for web service name and
the java implementation files, I do not know how to determine what number will
ultimately be used by the chooser, so it only checks the name as written against
possibly DD conflicts.  Thus, that is the name we have to use.
Comment 6 Martin Adamek 2005-11-15 15:34:11 UTC
Will need some more complex solution.
Comment 7 pwc 2007-06-18 17:38:14 UTC
You had included the wrong pwc on this bug.
Comment 8 Martin Balin 2016-07-07 08:55:58 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss