You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simone Tripodi <si...@apache.org> on 2011/07/02 20:05:37 UTC

[Digester] help on fixing NP_NULL_ON_SOME_PATH findbugs error

Hi all guys,
it could be a silly questions, but I need help on fixing a
NP_NULL_ON_SOME_PATH findbugs error, I don't see where the violation
is.
The problem is

    Possible null pointer dereference of CallMethodRule.paramTypes in
org.apache.commons.digester3.CallMethodRule.end(String, String) line
459

you can browse the class on SVN[1]

Many thanks in advance, feel free to commit yourself if/once found
where the bug is!!!
All the best, have a nice day,
Simo

[1] http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/CallMethodRule.java?view=markup

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [Digester] help on fixing NP_NULL_ON_SOME_PATH findbugs error

Posted by Simone Tripodi <si...@apache.org>.
Salut Luc,
just to let you know I finally figured out how to fix that error, take
a look at r1142280[1].
Thanks for your support, I'm now ready to push a new RC!
All the best, have a nice WE!
Simo

[1]http://svn.apache.org/viewvc?view=revision&revision=1142280

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Sat, Jul 2, 2011 at 9:25 PM, Simone Tripodi <si...@apache.org> wrote:
> Thanks for your help Luc!
> I'm currently investigating, the CallMethodRule worked in that way for
> ages - at least since before I joined the commons - the check you are
> proposing makes a lot of sense.
> I'll keep you updated, thanks!!!
> Have a nice day, all the best,
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
>
>
> On Sat, Jul 2, 2011 at 8:32 PM, Luc Maisonobe <Lu...@free.fr> wrote:
>> Le 02/07/2011 20:05, Simone Tripodi a écrit :
>>>
>>> Hi all guys,
>>> it could be a silly questions, but I need help on fixing a
>>> NP_NULL_ON_SOME_PATH findbugs error, I don't see where the violation
>>> is.
>>> The problem is
>>>
>>>     Possible null pointer dereference of CallMethodRule.paramTypes in
>>> org.apache.commons.digester3.CallMethodRule.end(String, String) line
>>> 459
>>
>> I guess parmarTypes can be null. If you explicitely test for null at some
>> point in your code, findbugs consider the corresponding variable is more
>> prone to be null and start to also check it.
>>
>> In this case, you test agains null at line 429, and in an unrelated code
>> path later on you use paramtypes (to get its length) without checking it is
>> null.
>>
>> Perhaps you should protect the building of the paramValues array when
>> paramTypes is null ?
>>
>> Luc
>>
>>>
>>> you can browse the class on SVN[1]
>>>
>>> Many thanks in advance, feel free to commit yourself if/once found
>>> where the bug is!!!
>>> All the best, have a nice day,
>>> Simo
>>>
>>> [1]
>>> http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/CallMethodRule.java?view=markup
>>>
>>> http://people.apache.org/~simonetripodi/
>>> http://www.99soft.org/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [Digester] help on fixing NP_NULL_ON_SOME_PATH findbugs error

Posted by Simone Tripodi <si...@apache.org>.
Thanks for your help Luc!
I'm currently investigating, the CallMethodRule worked in that way for
ages - at least since before I joined the commons - the check you are
proposing makes a lot of sense.
I'll keep you updated, thanks!!!
Have a nice day, all the best,
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Sat, Jul 2, 2011 at 8:32 PM, Luc Maisonobe <Lu...@free.fr> wrote:
> Le 02/07/2011 20:05, Simone Tripodi a écrit :
>>
>> Hi all guys,
>> it could be a silly questions, but I need help on fixing a
>> NP_NULL_ON_SOME_PATH findbugs error, I don't see where the violation
>> is.
>> The problem is
>>
>>     Possible null pointer dereference of CallMethodRule.paramTypes in
>> org.apache.commons.digester3.CallMethodRule.end(String, String) line
>> 459
>
> I guess parmarTypes can be null. If you explicitely test for null at some
> point in your code, findbugs consider the corresponding variable is more
> prone to be null and start to also check it.
>
> In this case, you test agains null at line 429, and in an unrelated code
> path later on you use paramtypes (to get its length) without checking it is
> null.
>
> Perhaps you should protect the building of the paramValues array when
> paramTypes is null ?
>
> Luc
>
>>
>> you can browse the class on SVN[1]
>>
>> Many thanks in advance, feel free to commit yourself if/once found
>> where the bug is!!!
>> All the best, have a nice day,
>> Simo
>>
>> [1]
>> http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/CallMethodRule.java?view=markup
>>
>> http://people.apache.org/~simonetripodi/
>> http://www.99soft.org/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [Digester] help on fixing NP_NULL_ON_SOME_PATH findbugs error

Posted by Luc Maisonobe <Lu...@free.fr>.
Le 02/07/2011 20:05, Simone Tripodi a écrit :
> Hi all guys,
> it could be a silly questions, but I need help on fixing a
> NP_NULL_ON_SOME_PATH findbugs error, I don't see where the violation
> is.
> The problem is
>
>      Possible null pointer dereference of CallMethodRule.paramTypes in
> org.apache.commons.digester3.CallMethodRule.end(String, String) line
> 459

I guess parmarTypes can be null. If you explicitely test for null at 
some point in your code, findbugs consider the corresponding variable is 
more prone to be null and start to also check it.

In this case, you test agains null at line 429, and in an unrelated code 
path later on you use paramtypes (to get its length) without checking it 
is null.

Perhaps you should protect the building of the paramValues array when 
paramTypes is null ?

Luc

>
> you can browse the class on SVN[1]
>
> Many thanks in advance, feel free to commit yourself if/once found
> where the bug is!!!
> All the best, have a nice day,
> Simo
>
> [1] http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/CallMethodRule.java?view=markup
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org