[Java-gnome-developer] Possible error in LibGlade.java
Brought to you by:
afcowie
From: Clint A. <ca...@au...> - 2005-03-11 18:16:34
|
This could just be me doing something wrong, but I've got a strange problem here. I've got some singleton classes which extend LibGlade. As part of my testing, I'm instantiating them when the Glade XML data file doesn't exist, so they should throw FileNotFoundException or the like. And they do, the FIRST time. The second time, the entire JVM crashes, leaving a big trace file (I attached one for ya'll to look at). Here's an example of the code in question: public final class InputEditGlade extends LibGlade { /* The Glade data file (doesn't exist, so constructor should throw * an exception). */ private static final String GLADE_FILE = "glade/inputedit.glade"; // The singleton instance. private static InputEditGlade _instance = null; // Singleton constructor. private InputEditGlade() throws GladeXMLException, FileNotFoundException, IOException { super(GLADE_FILE, new InputEditLogic()); } /** * @return * The singleton instance of this class. */ public static InputEditGlade getInstance() { if (_instance == null) { try { _instance = new InputEditGlade(); } catch (final GladeXMLException e) { Notifier.getInstance().exception(e, "An exception occurred " + "while trying to parse the Input/Edit Glade " + "file.", Level.ERROR); } catch (final FileNotFoundException e) { Notifier.getInstance().exception(e, "The input/edit Glade"+ " file could not be found.", Level.ERROR); } catch (final IOException e) { Notifier.getInstance().exception(e, "An I/O exception occurred " + "while trying to read the Input/Edit Glade " + "file.", Level.ERROR); } catch (final Exception e) { Notifier.getInstance().exception(e, "An unknown exception occurred while trying" + " to load the Glade file.", Level.ERROR); } } return _instance; } } The first time through, the constructor properly throws an exception. The second time through is when the crash happens. I've looked at the source for the LibGlade class, as well as the libglade C sources, and I can't figure this one out. Any ideas? |