dev@glassfish.java.net

Re: dangerous code pattern

From: Sreenivas Munnangi <sreenivas.munnangi_at_Sun.COM>
Date: Wed, 29 Mar 2006 12:17:34 -0800

This has been modified in 1.6

> if (children.item(ii).getFirstChild() != null) {
> jdbcResource.setDescription(
>
children.item(ii).getFirstChild().getNodeValue());
> }
mrkr[934]:



Byron Nevins wrote On 03/29/06 09:43 AM,:

>Where is the "dangerous" part?
>
>
> String str = null;
> try {
> str = children.item(ii).getFirstChild().getNodeValue();
> } catch (java.lang.NullPointerException npe) {
> str = "";
> }
> jdbcResource.setDescription(str);
>
>
>vince.kraemer_at_Sun.COM wrote:
>
>
>
>>A few days ago, I filed issue 434...
>>
>>it was pretty easy to fix.
>>
>>Then, I ran into a similar bug, in the same file that had 434.
>>
>>I looked at the root cause of 434 and the "new" bug.
>>
>>They both had the same "code pattern".
>>
>>I just did a fish-eye search, to see if there were other instances of the same pattern.
>>
>>http://fisheye5.cenqua.com/search/glassfish/?comment=&contents=getFirstChild%28%29.getNodeValue%28%29&filename=&branch=&tag=&fromdate=&todate=&groupby=changeset&refresh=y
>>
>>It might be good to have somebody look at modules/files that have this pattern
>>to verify that there aren't more issues like 434 waiting to strike.
>>
>>vbk
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
>