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 54627 - webservice operations are not visible after renaming package
Summary: webservice operations are not visible after renaming package
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Martin Grebac
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-07 14:08 UTC by Lukas Jungmann
Modified: 2007-09-26 09:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
diff files (1012 bytes, application/x-compressed)
2005-03-31 14:36 UTC, Daniel Prusa
Details
ComponentMethodModel.diff (1.54 KB, text/plain)
2005-03-31 15:57 UTC, Daniel Prusa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Jungmann 2005-02-07 14:08:45 UTC
[build 200502061900]

   Have [ejb module|web app] with web service
which contains some operations. Let this web
service be in package a. Rename package a to eg. b
(use refactoring).

=> web service operations are not visible in
project view, user have to reopen project/restart IDE
Comment 1 Martin Grebac 2005-03-24 18:21:30 UTC
There seem to be a problem in src bridge, as an empty MethodElement array is
obtained from ClassElement, but the method(s) should be there.
 See
org.netbeans.modules.j2ee.common.ui.nodes.ComponentMethodModel.updateKeys(). The
class element there is correctly updated to new package, but it does not return
any methods.
 When I tried (in that method) to resolve the class through jmi and obtain list
of methods through jmi, then the list of methods is returned correctly. First I
wanted to rewrite the updatekeys method to jmi, but then I realized that this
would require rewrite of almost all nodes which may be quite risky these times.

 I don't know why the information isn't synchronized, so reassigning to java
team for deeper evaluation. 
 If there's anything we can do on our side, please let me know.
Comment 2 Martin Matula 2005-03-24 18:52:19 UTC
Dan, please look at it.
Comment 3 Daniel Prusa 2005-03-30 12:58:48 UTC
There is a problem that whenever a package is renamed, all resources (and java
classes residing in them) are deleted and created again - the old jmi elements
become invalid. Src hierarchy elements keep the old, invalid jmi elements (there
is no refresh mechanism for this case, it is only implemented  by SourceElement)
which causes that no methods are returned when a class element is queried.

This problem can be solved in the javacore module (do not recreate resource
elements when a package is renamed) or in src bridge (implement some refresh
mechanism also for ClassElements, MethodsElements, etc.), however, both these
solutions are risky - to implement the refresh mechanism in src bridge will
require a lot of changes.

Another solution is to not pass the interfaces parameter to ComponentMethodModel
constructor, use getInterfaces method whenever the interfaces are needed and
implement getInterfaces method in subtypes as follows:

protected Collection getInterfaces() {
  return controller.getLocalInterfaces();
}

It works since the interfaces are obtained from SourceElements that are able to
refresh their jmi resource element. On the other hand, this fix is local only,
there can be possibly another situations when renaming of a package would cause
problems...
Comment 4 Daniel Prusa 2005-03-31 14:36:09 UTC
Created attachment 21267 [details]
diff files
Comment 5 Martin Grebac 2005-03-31 14:43:07 UTC
Thanks for the patch, I'll fix it that way. It's easy and safe solution for 4.1
- if there are more problems found, we may decide to go for a different fix, but
for now I think it's ok.
Comment 6 Daniel Prusa 2005-03-31 15:55:16 UTC
I have found one more problem in ComponentMethodModel (with listeners that must
be registered again when class elements became invalid after package rename),
replace related diff file in the previous attachement with the diff file that
follows, please.
Comment 7 Daniel Prusa 2005-03-31 15:57:32 UTC
Created attachment 21270 [details]
ComponentMethodModel.diff
Comment 8 Martin Grebac 2005-03-31 21:29:56 UTC
Fixed in trunk. Some more changes were needed.
Comment 9 Lukas Jungmann 2005-09-14 17:18:51 UTC
v.