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 16342 - Editor DTDs should be registered with nbres: not nbrescurr:
Summary: Editor DTDs should be registered with nbres: not nbrescurr:
Status: CLOSED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Martin Roskanin
URL:
Keywords:
Depends on:
Blocks: 16265
  Show dependency tree
 
Reported: 2001-10-08 15:02 UTC by Jesse Glick
Modified: 2007-11-05 13:44 UTC (History)
1 user (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 Jesse Glick 2001-10-08 15:02:26 UTC
This is a workaround for the P2 bug #16265. I see that the editor layer
registers its DTDs using nbrescurr: protocol. Besides this not working reliably
at the moment due to #16265, this is poor style anyway: needlessly inefficient
and could be broken if the user happens to have such files mounted somewhere
(e.g. editor sources mounted). Please use nbres: protocol which searches only
the systemClassLoader (which will include the module JAR where these DTDs live).

Additionally, the annotation type DTD should be in
core/src/org/netbeans/core/resources/mf-dtds.xml rather than in the editor
layer, since this is a DTD corresponding to a published Open API and the DTD
ought to be available even if the standard NB editor is not installed (if
someone else recognizes annotations and does their own parsing).
Comment 1 Martin Roskanin 2001-10-10 15:51:00 UTC
Jesse, 
this workaround doesn't work correctly:
Yes, exceptions -
(nbrescurr:/org/netbeans/modules/editor/resources/AnnotationTypes/annotation-type-1_0.dtd. No such 
resource was found.) have lost from ide.log but the problem is in classLoader I think.

(If I tried this workaround only bookmark annotation appeared in Annotation types folder after 
reinstalling of editor.)

But the main problem is not in annotations but in editor XML options files.

Try to open editor settings, then change some property, i.e in java editor line numbers. Then reinstall 
editor and return back to line numbers prop. The default value is used because existed properties.xml 
file is not recognized because of different classloaders.
The problem is that I use : 
if (!MIMEProcessor.class.isAssignableFrom(cookies[i].instanceClass() )) ...
to check instanceClass before creating it
and cookies[i].instanceClass has old classLoader. (From previous editor installation)

Classloaders:
MIMEProcessor:org.netbeans.core.modules.Module$OneModuleClassLoader@5ae27f[org.netbeans.modules.editor]
IC:org.netbeans.core.modules.Module$OneModuleClassLoader@7102d3[org.netbeans.modules.editor]


Comment 2 Martin Roskanin 2001-10-10 16:56:38 UTC
I have tried the following:

I attached a listener to every editor XML MIMEOptionFile on Editor module uninstallation. So during
uninstallation of editor I set XMLDataObject of all my settings XML files as invalid. After installation 
of editor all editor settings work fine. A new classloader is finally used! Is that solution legal? I 
think it looks rather strange ;-)

Mato

P.S.: I used nbres protocol ...

Comment 3 Jesse Glick 2001-10-10 18:27:20 UTC
Please try with fix for #16265 in place which changes things, and also
refer to the other editor bug I filed (linked to from #16265).
TopManager should now be firing PROP_SYSTEM_CLASS_LOADER but this is
undocumented and anyway ann types are not required to use nbresloc: so
this would be weird.

Re. XML files: they must be marked invalid somehow during
uninstallation of the module; assuming you are using XMLDO.P, nobody
is going to do this for you (unfortunately) since XMLDO does not to my
knowledge detach processors from XML files when the processors'
modules are uninstalled. So you probably do have to listen to the
editor module being uninstalled, currently. And XMLDO.P provides no
way to detach a cookie, you need Environment.Provider.

.settings files do something somewhat different by listening for
enablement changes in the module providing the setting. Your situation
is simpler because only the state of the editor module matters. (You
could, if you really wanted to, suppress customized annotations from
uninstalled modules. Otherwise their icons etc. will not be found and
might throw exceptions if browsed to. This would require a DTD change
to include module name.)
Comment 4 Martin Roskanin 2001-10-11 10:27:44 UTC
fixed in [maintrunk]

Using nbres instead of nbrescurr protocol for editor options and annotations.
Also detaching processors from XMLDOs during editor module uninstallation.

/cvs/editor/src/org/netbeans/modules/editor/options/AllOptionsNode.java,v  <--  
AllOptionsNode.java
new revision: 1.6; previous revision: 1.5

/cvs/editor/src/org/netbeans/modules/editor/options/MIMEOptionFile.java,v  <--  
MIMEOptionFile.java
new revision: 1.4; previous revision: 1.3

/cvs/editor/src/org/netbeans/modules/editor/resources/layer.xml,v  <--  layer.xml
new revision: 1.16; previous revision: 1.15

Comment 5 David Konecny 2001-10-11 10:40:53 UTC
For the move of annotation DTD from editor to core I will file 
separate issue.
Comment 6 Quality Engineering 2003-06-30 18:02:47 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 7 Quality Engineering 2003-06-30 18:12:55 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.