dev@glassfish.java.net

Re: dangerous code pattern

From: Byron Nevins <byron.nevins_at_Sun.COM>
Date: Wed, 29 Mar 2006 09:43:58 -0800

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
>
>
>