Details
-
Bug
-
Resolution: Done
-
Major
-
JBossAS-4.0.0 Final
-
None
-
None
Description
SourceForge Submitter: rgrzywinski .
server/src/main/org/jboss/naming/NamingService.java's
startService() assumes that "jndi.properties" exists in
the lines:
InputStream is = loader.getResourceAsStream
("jndi.properties");
Properties props = new Properties();
props.load(is);
If "jndi.properties" does not exist an NPE is thrown rather
than a more useful (sane) exception. The code would
be better served to read:
InputStream is = loader.getResourceAsStream
("jndi.properties");
if(is == null)
throw new WhateverTheStandardExceptionIs
(<"jndi.properties" could not be found. Ensure that it
exists in the conf directory.>);
/* else – "jndi.properties" exists and was loaded */
Properties props = new Properties();
props.load(is);
Where the text in <>'s is replaced with whatever the
standard resource bundle mechanism is.
I would also like to point out that by
throwing "Exception" on "startService()" you are doing a
disservice to users of the application since exceptions
that may have otherwise caught and meaningful
messages provided are being bubbled out in their raw
state. I will save this battle for another day =D