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.
While loading my module an error dialog with the following exception was raised. But this exception didn't help me in figuring out what the problem was as it was not the original exception, nor was the original exception anywhere to be found. When I tried catching throwables in what turned out to be the offending method (the data loader's initialize) and printing them, then the error was immediately obvious. Two exceptions are listed: 1) exception as reported by NetBeans (i.e. what I got), 2) actual exception that was being thrown (i.e. what I would have liked to have seen): Exception as reported by NetBeans: ================================== Tue Sep 18 13:35:13 PDT 2001: java.lang.reflect.InvocationTargetException: java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.openide.util.SharedClassObject.findObject (SharedClassObject.java:395) at org.openide.modules.ManifestSection.createInstance (ManifestSection.java:96) at org.openide.modules.ManifestSection.getInstance (ManifestSection.java:127) at org.openide.modules.ManifestSection$LoaderSection.getLoader (ManifestSection.java:370) at org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:143) at org.netbeans.core.ModuleItem$InstallIterator.processLoader (ModuleItem.java:1126) at org.openide.modules.ManifestSection$LoaderSection.invokeIterator (ManifestSection.java:393) at org.openide.modules.ModuleDescription.forEachSection (ModuleDescription.java:523) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:724) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:713) at org.netbeans.core.ModuleInstaller.initialize (ModuleInstaller.java:212) at org.netbeans.core.NonGui.run(NonGui.java:484) at org.netbeans.core.Main.run(Main.java:187) at org.openide.TopManager.initializeTopManager(TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:274) at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90) at java.lang.Thread.run(Thread.java:484) java.lang.InstantiationException: java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.openide.util.SharedClassObject.findObject (SharedClassObject.java:395) at org.openide.modules.ManifestSection.createInstance (ManifestSection.java:96) at org.openide.modules.ManifestSection.getInstance (ManifestSection.java:127) at org.openide.modules.ManifestSection$LoaderSection.getLoader (ManifestSection.java:370) at org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:143) at org.netbeans.core.ModuleItem$InstallIterator.processLoader (ModuleItem.java:1126) at org.openide.modules.ManifestSection$LoaderSection.invokeIterator (ManifestSection.java:393) at org.openide.modules.ModuleDescription.forEachSection (ModuleDescription.java:523) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:724) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:713) at org.netbeans.core.ModuleInstaller.initialize (ModuleInstaller.java:212) at org.netbeans.core.NonGui.run(NonGui.java:484) at org.netbeans.core.Main.run(Main.java:187) at org.openide.TopManager.initializeTopManager(TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:274) at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90) at java.lang.Thread.run(Thread.java:484) at org.openide.modules.ManifestSection$LoaderSection.getLoader (ManifestSection.java:372) at org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:143) at org.netbeans.core.ModuleItem$InstallIterator.processLoader (ModuleItem.java:1126) at org.openide.modules.ManifestSection$LoaderSection.invokeIterator (ManifestSection.java:393) at org.openide.modules.ModuleDescription.forEachSection (ModuleDescription.java:523) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:724) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:713) at org.netbeans.core.ModuleInstaller.initialize (ModuleInstaller.java:212) at org.netbeans.core.NonGui.run(NonGui.java:484) at org.netbeans.core.Main.run(Main.java:187) at org.openide.TopManager.initializeTopManager(TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:274) at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90) [catch] at java.lang.Thread.run(Thread.java:484) Tue Sep 18 13:35:13 PDT 2001: java.lang.reflect.InvocationTargetException: null java.lang.reflect.InvocationTargetException: java.lang.IllegalStateException: TPtoEJB.TPtoEJBDataLoader@5dfaf1 at org.openide.util.SharedClassObject$DataEntry.tryToInitialize (SharedClassObject.java:661) at org.openide.util.SharedClassObject$DataEntry.getMap (SharedClassObject.java:587) at org.openide.util.SharedClassObject.putProperty (SharedClassObject.java:219) at org.openide.loaders.DataLoader.<init>(DataLoader.java:67) at org.openide.loaders.MultiFileLoader.<init>(MultiFileLoader.java:36) at org.openide.loaders.UniFileLoader.<init>(UniFileLoader.java:39) at com.sun.forte4j.toolbuilder.genericgenerator.GenericGeneratorDataLoader.<init> (GenericGeneratorDataLoader.java:37) at TPtoEJB.TPtoEJBDataLoader.<init>(TPtoEJBDataLoader.java:18) at java.lang.reflect.Constructor.newInstance(Native Method) at org.openide.util.SharedClassObject.createInstancePrivileged (SharedClassObject.java:429) at org.openide.util.SharedClassObject$SetAccessibleAction.run (SharedClassObject.java:715) at java.security.AccessController.doPrivileged(Native Method) at org.openide.util.SharedClassObject.findObject (SharedClassObject.java:392) at org.openide.modules.ManifestSection.createInstance (ManifestSection.java:96) at org.openide.modules.ManifestSection.getInstance (ManifestSection.java:127) at org.openide.modules.ManifestSection$LoaderSection.getLoader (ManifestSection.java:370) at org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:143) at org.netbeans.core.ModuleItem$InstallIterator.processLoader (ModuleItem.java:1126) at org.openide.modules.ManifestSection$LoaderSection.invokeIterator (ManifestSection.java:393) at org.openide.modules.ModuleDescription.forEachSection (ModuleDescription.java:523) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:724) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:713) at org.netbeans.core.ModuleInstaller.initialize (ModuleInstaller.java:212) at org.netbeans.core.NonGui.run(NonGui.java:484) at org.netbeans.core.Main.run(Main.java:187) at org.openide.TopManager.initializeTopManager(TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:274) at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90) [catch] at java.lang.Thread.run(Thread.java:484) Exception actually being thrown: ================================ java.util.MissingResourceException: Can't find bundle for base name TPtoEJB.Bund le, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle .java:707) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:679) at java.util.ResourceBundle.getBundle(ResourceBundle.java:575) at org.openide.util.NbBundle.getBundle(NbBundle.java:327) at org.openide.util.NbBundle.getBundle(NbBundle.java:275) at org.openide.util.NbBundle.getMessage(NbBundle.java:393) at com.sun.forte4j.toolbuilder.genericgenerator.GenericGeneratorDataLoad er.defaultDisplayName(GenericGeneratorDataLoader.java:49) at com.sun.forte4j.toolbuilder.genericgenerator.GenericGeneratorDataLoad er.getModuleName(GenericGeneratorDataLoader.java:43) at com.sun.forte4j.toolbuilder.genericgenerator.GenericGeneratorDataLoad er.initialize(GenericGeneratorDataLoader.java:70) at org.openide.util.SharedClassObject$DataEntry.tryToInitialize(SharedCl assObject.java:656) at org.openide.util.SharedClassObject$DataEntry.getMap(SharedClassObject .java:587) at org.openide.util.SharedClassObject.putProperty(SharedClassObject.java :219) at org.openide.loaders.DataLoader.<init>(DataLoader.java:67) at org.openide.loaders.MultiFileLoader.<init>(MultiFileLoader.java:36) at org.openide.loaders.UniFileLoader.<init>(UniFileLoader.java:39) at com.sun.forte4j.toolbuilder.genericgenerator.GenericGeneratorDataLoad er.<init>(GenericGeneratorDataLoader.java:37) at TPtoEJB.TPtoEJBDataLoader.<init>(TPtoEJBDataLoader.java:18) at java.lang.reflect.Constructor.newInstance(Native Method) at org.openide.util.SharedClassObject.createInstancePrivileged(SharedCla ssObject.java:429) at org.openide.util.SharedClassObject$SetAccessibleAction.run(SharedClas sObject.java:715) at java.security.AccessController.doPrivileged(Native Method) at org.openide.util.SharedClassObject.findObject(SharedClassObject.java: 392) at org.openide.modules.ManifestSection.createInstance(ManifestSection.ja va:96) at org.openide.modules.ManifestSection.getInstance(ManifestSection.java: 127) at org.openide.modules.ManifestSection$LoaderSection.getLoader(ManifestS ection.java:370) at org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:143) at org.netbeans.core.ModuleItem$InstallIterator.processLoader(ModuleItem .java:1126) at org.openide.modules.ManifestSection$LoaderSection.invokeIterator(Mani festSection.java:393) at org.openide.modules.ModuleDescription.forEachSection(ModuleDescriptio n.java:523) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:724) at org.netbeans.core.ModuleItem.restoreSection(ModuleItem.java:713) at org.netbeans.core.ModuleInstaller.initialize(ModuleInstaller.java:212 ) at org.netbeans.core.NonGui.run(NonGui.java:484) at org.netbeans.core.Main.run(Main.java:187) at org.openide.TopManager.initializeTopManager(TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:274) at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90) at java.lang.Thread.run(Thread.java:484)
Are you running with -J-Dnetbeans.debug.exceptions=true on and checking your ide.log file? If not, and doing so makes the exceptions appear, please close this as INVALID.
The problem is not that an exception is not reported. The problem is that the exception that is reported is not the one that was originally raised and which is the actual cause of the problem. Setting the indicated flag only causes the exception that is already being reported in an error dialog to be written to the log file as well. Also note: I'm glad an exception is being reported (now it needs to be the right one). If no exception had been reported unless I set some magic flag then I'd be really upset. I don't think that is a valuable policy.
I cannot reproduce any problem [dev sep 23]. I tried making a data loader which throws a MissingResourceException from its defaultDisplayName() method. This is called via getDisplayName by BeanNode and the error is correctly reported (when the loader is first displayed in Object Types). Your loader tries to call defaultDisplayName() from some method in the loader inside initialize(), I'm not sure why (this defeats the purpose of defaultDisplayName: trying to avoid ever having to call it unless the Object Types node is actually displayed), but anyway to match that behavior I changed the loader to throw the MRE from within initialize(). This was also correctly reported with full stack trace (in the exception dialog, console, etc.). Are you sure that 3.3 dev is the correct version marking here? I see your code is using the old module installer so I am guessing you are actually using Pilsen. As far as I know the same error-handling code was present in 3.2 as well: if an exception is thrown from SharedClassObject.initialize() it is saved; IllegalStateException annotated with it is thrown; and any subsequent attempts to access the object's state again throw an IllegalStateException annotated with the original runtime exception. (Obviously it would be better to throw the exception from the call to SharedClassObject.findObject in the first place so that no illegal object reference would be returned at all, but this is not possible as initialize() is delayed until a state variable is first requested.) Re. the netbeans.debug.exceptions=true flag, I believe this mainly controls whether low-impact exceptions are printed to console as well as to log file; but I am not completely sure what ErrorManager does with this.
The problem doesn't have anything to do with defaultDisplayName but with exceptions in initialize. I tried looking up an unknown key in a bundle in initialize in the 9/24/01 build and experienced the same problem: the wrong exception is reported, if I trap the exception and report it myself I get the right one. Here are the two exceptions: No labelName, no try block: =========================== Tue Oct 02 08:56:31 PDT 2001: java.lang.reflect.InvocationTargetException: null java.lang.IllegalArgumentException at org.openide.util.SharedClassObject.findObject (SharedClassObject.java:413) at org.netbeans.core.modules.ManifestSection.createInstance (ManifestSection.java:177) at org.netbeans.core.modules.ManifestSection.getInstance (ManifestSection.java:195) at org.netbeans.core.LoaderPoolNode.add (LoaderPoolNode.java:145) at org.netbeans.core.modules.NbInstaller.loadLoaderSection (NbInstaller.java:459) at org.netbeans.core.modules.NbInstaller.loadSections (NbInstaller.java:354) at org.netbeans.core.modules.NbInstaller.load (NbInstaller.java:192) at org.netbeans.core.modules.ModuleManager.enable (ModuleManager.java:529) at org.netbeans.core.modules.ModuleList.installNew (ModuleList.java:458) at org.netbeans.core.modules.ModuleList.trigger (ModuleList.java:418) at org.netbeans.core.modules.ModuleSystem.scanForNewAndRestore (ModuleSystem.java:252) at org.netbeans.core.NonGui.run(NonGui.java:517) at org.netbeans.core.Main.run(Main.java:216) at org.openide.TopManager.initializeTopManager (TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:325) at org.netbeans.core.TopThreadGroup.run (TopThreadGroup.java:90) [catch] at java.lang.Thread.run(Thread.java:484) Tue Oct 02 08:56:31 PDT 2001: java.lang.reflect.InvocationTargetException: null java.lang.reflect.InvocationTargetException: java.lang.IllegalStateException: com.sun.forte4j.toolbuilder.ToolBuilderDataLoader@79f91d at org.openide.util.SharedClassObject$DataEntry.tryToInitialize (SharedClassObject.java:826) at org.openide.util.SharedClassObject$DataEntry.getMap (SharedClassObject.java:752) at org.openide.util.SharedClassObject.putProperty (SharedClassObject.java:239) at org.openide.loaders.DataLoader.<init>(DataLoader.java:70) at org.openide.loaders.MultiFileLoader.<init> (MultiFileLoader.java:36) at org.openide.loaders.UniFileLoader.<init> (UniFileLoader.java:39) at com.sun.forte4j.genericgenerator.GenericGeneratorDataLoader.<init> (GenericGeneratorDataLoader.java:34) at com.sun.forte4j.toolbuilder.ToolBuilderDataLoader.<init> (ToolBuilderDataLoader.java:16) at java.lang.reflect.Constructor.newInstance(Native Method) at org.openide.util.SharedClassObject.createInstancePrivileged (SharedClassObject.java:463) at org.openide.util.SharedClassObject$SetAccessibleAction.run (SharedClassObject.java:893) at java.security.AccessController.doPrivileged(Native Method) at org.openide.util.SharedClassObject.findObject (SharedClassObject.java:410) at org.netbeans.core.modules.ManifestSection.createInstance (ManifestSection.java:177) at org.netbeans.core.modules.ManifestSection.getInstance (ManifestSection.java:195) at org.netbeans.core.LoaderPoolNode.add (LoaderPoolNode.java:145) at org.netbeans.core.modules.NbInstaller.loadLoaderSection (NbInstaller.java:459) at org.netbeans.core.modules.NbInstaller.loadSections (NbInstaller.java:354) at org.netbeans.core.modules.NbInstaller.load (NbInstaller.java:192) at org.netbeans.core.modules.ModuleManager.enable (ModuleManager.java:529) at org.netbeans.core.modules.ModuleList.installNew (ModuleList.java:458) at org.netbeans.core.modules.ModuleList.trigger (ModuleList.java:418) at org.netbeans.core.modules.ModuleSystem.scanForNewAndRestore (ModuleSystem.java:252) at org.netbeans.core.NonGui.run(NonGui.java:517) at org.netbeans.core.Main.run(Main.java:216) at org.openide.TopManager.initializeTopManager (TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:325) at org.netbeans.core.TopThreadGroup.run (TopThreadGroup.java:90) [catch] at java.lang.Thread.run(Thread.java:484) *** With try block: =================== Stack trace in initialize: java.util.MissingResourceException: Can't find resource for bundle java.util.Pro pertyResourceBundle, key LBL_loaderName at java.util.ResourceBundle.getObject(ResourceBundle.java:382) at java.util.ResourceBundle.getString(ResourceBundle.java:354) at org.openide.util.NbBundle.getMessage(NbBundle.java:403) at com.sun.forte4j.genericgenerator.GenericGeneratorDataLoader.defaultDi splayName(GenericGeneratorDataLoader.java:56) at org.openide.loaders.DataLoader.getDisplayName (DataLoader.java:174) at com.sun.forte4j.genericgenerator.GenericGeneratorDataLoader.initializ e(GenericGeneratorDataLoader.java:82) at org.openide.util.SharedClassObject$DataEntry.tryToInitialize(SharedCl assObject.java:821) at org.openide.util.SharedClassObject$DataEntry.getMap (SharedClassObject .java:752) at org.openide.util.SharedClassObject.putProperty (SharedClassObject.java :239) at org.openide.loaders.DataLoader.<init>(DataLoader.java:70) at org.openide.loaders.MultiFileLoader.<init> (MultiFileLoader.java:36) at org.openide.loaders.UniFileLoader.<init> (UniFileLoader.java:39) at com.sun.forte4j.genericgenerator.GenericGeneratorDataLoader.<init>(Ge nericGeneratorDataLoader.java:34) at com.sun.forte4j.toolbuilder.ToolBuilderDataLoader.<init> (ToolBuilderD ataLoader.java:16) at java.lang.reflect.Constructor.newInstance(Native Method) at org.openide.util.SharedClassObject.createInstancePrivileged (SharedCla ssObject.java:463) at org.openide.util.SharedClassObject$SetAccessibleAction.run (SharedClas sObject.java:893) at java.security.AccessController.doPrivileged(Native Method) at org.openide.util.SharedClassObject.findObject (SharedClassObject.java: 410) at org.netbeans.core.modules.ManifestSection.createInstance (ManifestSect ion.java:177) at org.netbeans.core.modules.ManifestSection.getInstance (ManifestSection .java:195) at org.netbeans.core.LoaderPoolNode.add (LoaderPoolNode.java:145) at org.netbeans.core.modules.NbInstaller.loadLoaderSection (NbInstaller.j ava:459) at org.netbeans.core.modules.NbInstaller.loadSections (NbInstaller.java:3 54) at org.netbeans.core.modules.NbInstaller.load (NbInstaller.java:192) at org.netbeans.core.modules.ModuleManager.enable (ModuleManager.java:529 ) at org.netbeans.core.modules.ModuleList.installNew (ModuleList.java:458) at org.netbeans.core.modules.ModuleList.trigger (ModuleList.java:418) at org.netbeans.core.modules.ModuleSystem.scanForNewAndRestore (ModuleSys tem.java:252) at org.netbeans.core.NonGui.run(NonGui.java:517) at org.netbeans.core.Main.run(Main.java:216) at org.openide.TopManager.initializeTopManager (TopManager.java:120) at org.openide.TopManager.getDefault(TopManager.java:81) at org.netbeans.core.Main.main(Main.java:325) at org.netbeans.core.TopThreadGroup.run (TopThreadGroup.java:90) at java.lang.Thread.run(Thread.java:484)
As an additional benefit in the 9/24/01 build after the exception is reported the IDE goes into a CPU loop.
Jeff as I mentioned in my last comment I was not able to reproduce any problem; I have a test case where I specifically throw a MRE from initialize() and it was correctly reported. Could you please make a small standalone test case that I could try, since my test case did not reproduce it? fortecvs:/forte4j/home/jglick/testdevel/apitest/util/scobadinittest/ BTW contains my attempted test case. This throws an MRE from the constructor; you can try putting it in initialize() too. Re. infinite loop, please file a separate bug with thread dump.
Test case: 1) get the latest f4j_all modules: genericgenerator and toolbuilder from CVS. 2) remove the LBL_loadername key from f4j_all/toolbuilder/src/com/sun/forte4j/toolbuilder/Bundle.properties 3) build both modules and install them. 4) turn on tracing (dbg:com.sun.forte4j.toolbuilder:*:*) 5) enable the toolbuilder module You should see an exception about the missing resource key. If you remove the outermost try block in initialize you will not get this exception (at least I don't). I'm running on the 010817 build.
Thanks for the details, I will try this. It occurs to me that you are here using the logger module which overrides the normal org.netbeans.core.NbErrorManager, which is responsible for finding annotated exceptions and displaying them. So it is possible that the logger's ErrorManager implementation is not picking up all the annotations; I will try to investigate this.
Actually, we don't use the NbTraceErrorManager in FFJ. The default ErrorManager is still the normal Netbeans one. I seem to remember there being a ErrorManager implementation in the modules code, maybe in org/netbeans/core/modules/Events.java?
Yes there is a dummy ErrorManager in org.netbeans.core.modules but it is not used when this code is run inside the complete IDE, only as a standalone library.
I was finally able to reproduce this (took some work to build your module from sources). I'm not exactly sure why only you saw this exception, and a simple data loader with an error does not show it (the situation is pretty complicated), but anyway it seems somewhere there was an InvocationTargetException with a nested exception that itself had a throwable nested according to ErrorManager. Previously NbErrorManager did not do anything special with ITE and friends, which means it would just print the stack from the ITE, which would print the stack from the directly nested exception, but this leaves out the indirectly nested one. That is, the container throwable ITE was a weak link in the chain from the original problem to the finally caught one. Fixed NbErrorManager (1.24) to "know about" all container throwables in the JRE (as of 1.3), Open APIs, and standard Java XML APIs: will now traverse their nested throwables looking for its own annotations. Ultimately this sort of nonsense should disappear when JDK 1.4 and its built-in notion of nested causes is standard (if in fact existing container exception classes are modified to use the new methods in Throwable, which probably won't happen for years).
Resolved for 3.4.x or earlier, no new info since then -> verified
Resolved for 3.4.x or earlier, no new info since then -> closing.