You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2007/11/23 00:31:57 UTC

Re: svn commit: r597440 - /cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java

On 22.11.2007 10:49 Uhr, giacomo@apache.org wrote:
> Author: giacomo
> Date: Thu Nov 22 07:49:00 2007
> New Revision: 597440
> 
> URL: http://svn.apache.org/viewvc?rev=597440&view=rev
> Log:
> fixing NPE
> 
> Modified:
>     cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
> 
> Modified: cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
> URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java?rev=597440&r1=597439&r2=597440&view=diff
> ==============================================================================
> --- cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java (original)
> +++ cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java Thu Nov 22 07:49:00 2007
> @@ -159,8 +159,10 @@
>             String value = props.getProperty(key);
>             // replace
>             value = replace(value, props, settings);
> -           // and put back
> -           props.put(key, value);
> +           // and put back but prevent NPE because of null value ?!?!?
> +           // TODO: How to handle value==null situations?
> +           if (value != null)
> +               props.put(key, value);
>         }
>      }
>  }

How can this be null after all? From what I see value can only be null 
if value was null in the first place, i.e. before replace(..). This 
means that null must already have been in the Properties object which is 
kind of impossible since Properties.put(..) inherited from HashTable 
throws NPE on value being null.

Where do you have this Properties object from which is only injected by 
the user into AbstractSettingsBeanFactoryPostProcessor?

Joerg

Re: svn commit: r597440 - /cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joerg Heinicke wrote:
> On 22.11.2007 10:49 Uhr, giacomo@apache.org wrote:
>> +           // and put back but prevent NPE because of null value ?!?!?
>> +           // TODO: How to handle value==null situations?

I have same concerns as Joerg have, but to address this TODO, I'd guess - if it 
is ever possible - it should be
                if (value == null)
                    props.remove(key);
?

Vadim

>> +           if (value != null)
>> +               props.put(key, value);
>>         }
>>      }
>>  }
> 
> How can this be null after all? From what I see value can only be null 
> if value was null in the first place, i.e. before replace(..). This 
> means that null must already have been in the Properties object which is 
> kind of impossible since Properties.put(..) inherited from HashTable 
> throws NPE on value being null.
> 
> Where do you have this Properties object from which is only injected by 
> the user into AbstractSettingsBeanFactoryPostProcessor?
> 
> Joerg
> 


Re: svn commit: r597440 - /cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java

Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Joerg Heinicke wrote:
> On 23.11.2007 9:58 Uhr, Giacomo Pati wrote:
> 
>>> How can this be null after all? From what I see value can only be null
>>> if value was null in the first place, i.e. before replace(..). This
>>> means that null must already have been in the Properties object which is
>>> kind of impossible since Properties.put(..) inherited from HashTable
>>> throws NPE on value being null.
>>
>> Exactly! I have the situation where value _IS NULL_ and it throws a NPE.
>>
>>> Where do you have this Properties object from which is only injected by
>>> the user into AbstractSettingsBeanFactoryPostProcessor?
>>
>> I don't know where what is comming from. I suddenly had this NPE as
>> soon as I access a URL (while
>> something is creating a Setting bean).
> 
> Since you reverted the commit have you figured out where the null is
> coming from? I'm really curious how the original Properties object could
> have null.

No, actually I tried to reproduce but my app works again without that NPE. So I have no idea now.

Ciao

- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHSmMyLNdJvZjjVZARAo1QAJ0b+xym0m6biSQ/oLTapx4y6vw/hQCeO4Zb
abXW8cNUs0uj4pymKqbXvgc=
=3AVR
-----END PGP SIGNATURE-----

Re: svn commit: r597440 - /cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java

Posted by Joerg Heinicke <jo...@gmx.de>.
On 23.11.2007 9:58 Uhr, Giacomo Pati wrote:

>> How can this be null after all? From what I see value can only be null
>> if value was null in the first place, i.e. before replace(..). This
>> means that null must already have been in the Properties object which is
>> kind of impossible since Properties.put(..) inherited from HashTable
>> throws NPE on value being null.
> 
> Exactly! I have the situation where value _IS NULL_ and it throws a NPE.
> 
>> Where do you have this Properties object from which is only injected by
>> the user into AbstractSettingsBeanFactoryPostProcessor?
> 
> I don't know where what is comming from. I suddenly had this NPE as soon as I access a URL (while
> something is creating a Setting bean).

Since you reverted the commit have you figured out where the null is 
coming from? I'm really curious how the original Properties object could 
have null.

Joerg

Re: svn commit: r597440 - /cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java

Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Joerg Heinicke wrote:
> On 22.11.2007 10:49 Uhr, giacomo@apache.org wrote:
>> Author: giacomo
>> Date: Thu Nov 22 07:49:00 2007
>> New Revision: 597440
>>
>> URL: http://svn.apache.org/viewvc?rev=597440&view=rev
>> Log:
>> fixing NPE
>>
>> Modified:
>>    
>> cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
>>
>>
>> Modified:
>> cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
>>
>> URL:
>> http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java?rev=597440&r1=597439&r2=597440&view=diff
>>
>> ==============================================================================
>>
>> ---
>> cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
>> (original)
>> +++
>> cocoon/trunk/core/cocoon-configuration/cocoon-configuration-api/src/main/java/org/apache/cocoon/configuration/PropertyHelper.java
>> Thu Nov 22 07:49:00 2007
>> @@ -159,8 +159,10 @@
>>             String value = props.getProperty(key);
>>             // replace
>>             value = replace(value, props, settings);
>> -           // and put back
>> -           props.put(key, value);
>> +           // and put back but prevent NPE because of null value ?!?!?
>> +           // TODO: How to handle value==null situations?
>> +           if (value != null)
>> +               props.put(key, value);
>>         }
>>      }
>>  }
> 
> How can this be null after all? From what I see value can only be null
> if value was null in the first place, i.e. before replace(..). This
> means that null must already have been in the Properties object which is
> kind of impossible since Properties.put(..) inherited from HashTable
> throws NPE on value being null.

Exactly! I have the situation where value _IS NULL_ and it throws a NPE.

> Where do you have this Properties object from which is only injected by
> the user into AbstractSettingsBeanFactoryPostProcessor?

I don't know where what is comming from. I suddenly had this NPE as soon as I access a URL (while
something is creating a Setting bean).

- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHRuqELNdJvZjjVZARAmHEAJ0XDTe/Ly5vOMPAYYj/wcY1brqf/QCgggE8
GGbYl0z2x1Mxx3P5/xkuo20=
=+ub9
-----END PGP SIGNATURE-----