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.
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).
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]
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 ...
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.)
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
For the move of annotation DTD from editor to core I will file separate issue.
Resolved for 3.3.x or earlier, no new info since then -> closing.