deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: NPE question for PropertyFileConfigSource
Date Wed, 25 Jan 2012 08:18:47 GMT
hi jason,

i just checked the original source-code in myfaces codi and there 'null' is
part of the contract of the method.
however, you are right - here it doesn't make sense since we are using it
differently.

regards,
gerhard



2012/1/25 Jason Porter <lightguard.jp@gmail.com>

> As soon as I commit you'll see in rev 976dcbc the question I have, but for
> the sake of getting the conversation going I'll paste the method here:
>
>  private Properties loadProperties(URL url)
>    {
>        Properties props = new Properties();
>
>        InputStream inputStream = null;
>        try
>        {
>            inputStream = url.openStream();
>
>            if (inputStream != null)
>            {
>                props.load(inputStream);
>            }
>        }
>        catch (IOException e)
>        {
>            return null; // TODO: Shouldn't this return an empty
> Properties? Otherwise we could cause NPE in the getPropertyValue method
>        }
>        finally
>        {
>            try
>            {
>                if (inputStream != null)
>                {
>                    inputStream.close();
>                }
>            }
>            catch (IOException e)
>            {
>                // no worries, means that the file is already closed
>            }
>        }
>
>        return props;
>    }
>
> --
> Jason Porter
> http://lightguard-jp.blogspot.com
> http://twitter.com/lightguardjp
>
> Software Engineer
> Open Source Advocate
> Author of Seam Catch - Next Generation Java Exception Handling
>
> PGP key id: 926CCFF5
> PGP key available at: keyserver.net, pgp.mit.edu
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message