You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jason Dillon <ja...@planet57.com> on 2006/07/21 05:43:29 UTC

Minor bug in ServerConstants

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

<snip>
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));
         }
</snip>

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:

<snip>
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);
         }
</snip>

--jason

Re: Minor bug in ServerConstants

Posted by Jason Dillon <ja...@planet57.com>.
THe only time a user should get this message is if the build  
generated and invalid artifact... meaning that the version files was  
not generated correctly or put into the jar in the right place.

So, really these Error's are to be consumed by us, not end users.

--jason


On Jul 25, 2006, at 7:56 AM, Matt Hogstrom wrote:

> Is it possbile to expand on the message a bit to let someone know  
> what to do?  If a user get's this error what should they do?  I  
> understand its an exceptional condition but if we can give them a  
> hint as to what action to take I think that would be better.
>
> Jason Dillon wrote:
>> Looks like there is a minor bug in ServerConstants with this:
>> <snip>
>> 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));
>>         }
>> </snip>
>> 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:
>> <snip>
>> 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);
>>         }
>> </snip>
>> --jason


Re: Minor bug in ServerConstants

Posted by Matt Hogstrom <ma...@hogstrom.org>.
Is it possbile to expand on the message a bit to let someone know what to do?  If a user get's this 
error what should they do?  I understand its an exceptional condition but if we can give them a hint 
as to what action to take I think that would be better.

Jason Dillon wrote:
> Looks like there is a minor bug in ServerConstants with this:
> 
> <snip>
> 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));
>         }
> </snip>
> 
> 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:
> 
> <snip>
> 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);
>         }
> </snip>
> 
> --jason
> 
> 
>