Re: JList getSelectedValue returning null
- From: "ricky.clarkson@xxxxxxxxx" <ricky.clarkson@xxxxxxxxx>
- Date: 31 Dec 2005 05:04:16 -0800
This is really poor code, and running it through a code checking
utility such as CheckStyle would probably give the answer:
Object o=null;
try {
o=data.elementAt(index);
} catch (Exception ex) {
//System.out.println("Index out of bounds" +
ex.toString());
}
return o;
That looks like a good candidate for returning null. You are
swallowing all possible exceptions. DON'T.
http://findbugs.sourceforge.net/bugDescriptions.html#REC_CATCH_EXCEPTION
and
http://checkstyle.sourceforge.net/config_coding.html#IllegalCatch
.
- Follow-Ups:
- Re: JList getSelectedValue returning null
- From: soup_or_power@xxxxxxxxx
- Re: JList getSelectedValue returning null
- References:
- JList getSelectedValue returning null
- From: soup_or_power@xxxxxxxxx
- Re: JList getSelectedValue returning null
- From: IchBin
- JList getSelectedValue returning null
- Prev by Date: Re: generic oversight?
- Next by Date: Re: How to dedect 4 consecutive space
- Previous by thread: Re: JList getSelectedValue returning null
- Next by thread: Re: JList getSelectedValue returning null
- Index(es):