You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dan Finkelstein <da...@bluescope.com> on 2001/12/06 23:02:15 UTC
patch for property file handling
Hi --
I've noticed that ExtendedProperties.subset(prefix) returns null if no lines
match the prefix. I think this is a weakness in the API since it should
probably just return an empty ExtendedProperties object.
In my velocity code, I struggled trying to find why a null pointer exception
was being thrown and it turned out to be in
ResourceManager.assembleResourceLoaderInitializers(). This method calls
ExtendedProperties.subset() and just throws a NPE.
Here's the call to subset()...
ExtendedProperties loaderConfiguration =
rsvc.getConfiguration().subset(loaderID);
I added the second line...
if(loaderConfiguration == null)
throw new Exception("No \"" + loaderID + "\" properties
listed!");
But maybe instead you want this...
if(loaderConfiguration == null)
loaderConfiguration = new ExtendedProperties();
In either case, this odd condition will be handled correctly.
Geir, can you make this change in the source?
Thanks,
Dan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: patch for property file handling
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/6/01 5:02 PM, "Dan Finkelstein" <da...@bluescope.com> wrote:
> Hi --
>
> I've noticed that ExtendedProperties.subset(prefix) returns null if no lines
> match the prefix. I think this is a weakness in the API since it should
> probably just return an empty ExtendedProperties object.
>
> In my velocity code, I struggled trying to find why a null pointer exception
> was being thrown and it turned out to be in
> ResourceManager.assembleResourceLoaderInitializers(). This method calls
> ExtendedProperties.subset() and just throws a NPE.
>
> Here's the call to subset()...
>
> ExtendedProperties loaderConfiguration =
> rsvc.getConfiguration().subset(loaderID);
>
> I added the second line...
>
> if(loaderConfiguration == null)
> throw new Exception("No \"" + loaderID + "\" properties
> listed!");
>
> But maybe instead you want this...
>
> if(loaderConfiguration == null)
> loaderConfiguration = new ExtendedProperties();
>
> In either case, this odd condition will be handled correctly.
>
> Geir, can you make this change in the source?
Will do right now... We not heart NPEs... :)
> Thanks,
> Dan
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Be a giant. Take giant steps. Do giant things...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>