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 16265 - Wrong XML entity registration after uninstall/install.
Summary: Wrong XML entity registration after uninstall/install.
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 16342 16434
Blocks:
  Show dependency tree
 
Reported: 2001-10-05 10:32 UTC by Martin Roskanin
Modified: 2008-12-23 08:31 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception (18.87 KB, text/plain)
2001-10-05 11:08 UTC, Martin Roskanin
Details
While trying to reproduce I have found a deadlock in editor module (11.37 KB, text/plain)
2001-10-08 11:14 UTC, Jaroslav Tulach
Details
Proposed patch (4.30 KB, patch)
2001-10-10 15:01 UTC, Jesse Glick
Details | Diff
Hopefully better patch (5.58 KB, patch)
2001-10-10 16:43 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Roskanin 2001-10-05 10:32:58 UTC
After installation of the module (editor) the xml entities are registered via XML Layer to
Default System/xml/entities/NetBeans

After uninstallation of the module the DTDs are removed from that folder, and of course after re-installation they are registered again. But the problem is 
 that they are registered with the old instance. Like if they are cached somewhere.

You can reproduce this problem by following:

1. Start IDE (dev 05.10) and expand Editing/Annotation Types node in Options window.
2. You should get the Annotations subnodes.
3. Then uninstall and re-install editor module.
4. There is no Annotation node in Editing/Annotation Types node.
5. See the ide.log where is the exception: Could not connect to URL 
nbrescurr:/org/netbeans/modules/editor/resources/AnnotationTypes/annotation-type-1_0.dtd. No such resource was found.

I am attaching this exception as attachement.
Comment 1 Martin Roskanin 2001-10-05 11:08:33 UTC
Created attachment 2858 [details]
Exception
Comment 2 Jesse Glick 2001-10-05 14:00:06 UTC
org.netbeans.core.xml.FileEntityResolver might be at fault, but I am
not sure; it looks like it is getting an invalid file object, which
might mean a problem in org.openide.filesystems. I don't see any
caching in FER.
Comment 3 Jaroslav Tulach 2001-10-05 14:46:13 UTC
I'll take a look, but I do not think that unistall/install troubles
are beta stopers -> P2.
Comment 4 Jaroslav Tulach 2001-10-08 11:14:59 UTC
Created attachment 2890 [details]
While trying to reproduce I have found a deadlock in editor module
Comment 5 Jaroslav Tulach 2001-10-08 11:16:37 UTC
Please fix the deadlock, then return back, if the old behaviour
remains reproducible.
Comment 6 David Konecny 2001-10-08 12:34:55 UTC
Moving issue back to the OpenIDE. I was not able to reproduce the 
deadlock, however I know the cause from stack trace (thanx!), so I 
fixed it (locally) and tried to reproduce this bug and was successful, 
so the problem is still there and most probably in openide.

Jarda, you get the deadlock each time you try to reproduce this bug? 
Or was you able to reproduce the problem Mato described here?

I will commit the fix later afternoon, but it is not related to this 
problem.
Comment 7 Jaroslav Tulach 2001-10-08 13:32:02 UTC
Let me know when you integrate the fix. I am not able to get rid of
the deadlock.
Comment 8 David Konecny 2001-10-08 13:37:59 UTC
The fix was commited a few minutes ago into Editor. Please test it and 
let me know. Thanx.
Comment 9 Jaroslav Tulach 2001-10-08 13:58:04 UTC
Another bug in editor. I have just followed the steps described in the
bug and after enabling the module I have got this exception:

java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:380)
        at sun.awt.AppContext.put(AppContext.java:469)
        at
org.netbeans.modules.editor.EditorModule.uninstalled(EditorModule.java:177)
        at
org.netbeans.core.modules.NbInstaller.loadCode(NbInstaller.java:317)
        at
org.netbeans.core.modules.NbInstaller.unload(NbInstaller.java:243)
        at
org.netbeans.core.modules.ModuleManager.disable(ModuleManager.java:576)
        at
org.netbeans.core.ui.ModuleBean$AllModulesBean.doDisable(ModuleBean.java:571)
        at
org.netbeans.core.ui.ModuleBean$AllModulesBean.access$900(ModuleBean.java:230)
        at
org.netbeans.core.ui.ModuleBean$AllModulesBean$Updater.run(ModuleBean.java:472)
        at org.openide.util.Mutex.writeAccess(Mutex.java:330)
        at
org.netbeans.core.ui.ModuleBean$AllModulesBean$Updater.run(ModuleBean.java:412)
        at org.openide.util.Task.run(Task.java:152)
        at
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:611)

Comment 10 David Konecny 2001-10-08 14:07:26 UTC
This problem is filed as 16212, so I'm returning this issue back to 
the openide and I set dependency on 16212 (although I doubt that 
there is some relation). Hope you agree. Once the 16212 is fixed we 
can continue the work on this one.
Comment 11 Jaroslav Tulach 2001-10-08 14:12:09 UTC
I was able to find the cause of the bug in spite of the issue 16212.
Thus they probably do not depend.

The bug seems to be in ClassLoader system. After following all of the
described steps I tried:

r = org.openide.TopManager.getDefault ().systemClassLoader
().getResource (
"org/netbeans/modules/editor/resources/DTDs/Options/EditorMacros-1_0.dtd"
);

after which r != null and

r = org.openide.TopManager.getDefault ().currentClassLoader
().getResource (
"org/netbeans/modules/editor/resources/DTDs/Options/EditorMacros-1_0.dtd"
);

after which r == null

Because currentClassLoader should include everything from
systemClassLoader, the bug is in ClassLoaderSupport I guess.
Comment 12 Jesse Glick 2001-10-08 15:06:07 UTC
Hmm, that is pretty bad, I will look at it. Perhaps the classloader
change is not taking effect quickly enough (maybe in the future it
will be possible to turn off validation on XMLDataObject, in which
case I suspect this would not be a problem because the DTD would not
be required normally anyway). For a short-term workaround, please see
issue #16342 in the editor.
Comment 13 Jesse Glick 2001-10-08 15:08:59 UTC
BTW please make sure QA Contact is updated when changing components on
bugs.
Comment 14 Jesse Glick 2001-10-10 14:41:49 UTC
I have a patch which seems to work, will upload it shortly and then
being testing this (changes in classloader timing are potentially
dangerous).
Comment 15 Jesse Glick 2001-10-10 15:01:41 UTC
Created attachment 2936 [details]
Proposed patch
Comment 16 Jesse Glick 2001-10-10 15:19:23 UTC
Linking to editor bugs that would serve as workarounds or would make
the fix not solve the complete problem.
Comment 17 Jesse Glick 2001-10-10 15:52:23 UTC
The patch below is broken, back to work...
Comment 18 Jesse Glick 2001-10-10 16:43:41 UTC
Created attachment 2940 [details]
Hopefully better patch
Comment 19 Jesse Glick 2001-10-10 17:53:51 UTC
The second patch seems to work fine. Ran EE and enabled/disabled many
modules at once. Adding minor patch to ClassLoaderSupport for
occasional timing-related NPE.

1.21  core/src/org/netbeans/core/ClassLoaderSupport.java
1.123 core/src/org/netbeans/core/NbTopManager.java
1.15  core/src/org/netbeans/core/modules/ModuleManager.java
1.11  core/src/org/netbeans/core/modules/ModuleSystem.java

Thanks to Yarda for correctly diagnosing the problem.
Comment 20 Jaroslav Tulach 2001-10-12 08:26:01 UTC
That was not as hard.
Comment 21 Quality Engineering 2003-07-01 16:20:47 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.