Bug in ServerConstants cause NPE when geronimo-version.properties is missing
----------------------------------------------------------------------------

                 Key: GERONIMO-2213
                 URL: http://issues.apache.org/jira/browse/GERONIMO-2213
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
    Affects Versions: 1.2
            Reporter: Jason Dillon
         Assigned To: Jason Dillon
            Priority: Trivial
             Fix For: 1.2


Looks like there is a minor bug in ServerConstants with this:

{code:java}
static {
        Properties versionInfo = new Properties();
        try {
            
versionInfo.load(ServerConstants.class.getClassLoader().getResourceAsStream("org/apache/geronimo/system/serverinfo/geronimo-version.properties"));
        } catch (java.io.IOException e) {
            throw new ExceptionInInitializerError(new Exception("Could not load 
geronimo-version.properties", e));
        }
{code}

The problem is that if the properties files is not found, then a NPE is thrown 
which does not get caught by the IOException handler and then resulting 
ExceptionInInitializerError error does not contain the detail as to why.

I'm seeing this when trying to build the m2 site, looks like clover is not 
picking up the resources because they are not in the standard location where m2 
suggests they be.

While it is a minor problem, we really should modules to use the standard 
locations soonish.

I'm going to fix this with:

{code:java}
static {
        Properties versionInfo = new Properties();
        try {
            InputStream input = 
ServerConstants.class.getClassLoader().getResourceAsStream("org/apache/geronimo/system/serverinfo/geronimo-version.properties");
            if (input == null) {
                throw new Error("Missing geronimo-version.properties");
            }

            versionInfo.load(input);
        }
        catch (java.io.IOException e) {
            throw new Error("Could not load geronimo-version.properties", e);
        }
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to