[RFC][Icedtea-Web]: Ensure all ports entered are numeric values

Andrew Su asu at redhat.com
Fri Apr 8 07:08:16 PDT 2011



----- Original Message -----
> On 04/07/2011 07:34 PM, Dr Andrew John Hughes wrote:
> > On 17:01 Tue 05 Apr , Omair Majid wrote:
> >> On 04/05/2011 04:27 PM, Andrew Su wrote:
> >
> > snip...
> >
> >>> + public void insertString(int offs, String str, AttributeSet a)
> >>> throws BadLocationException {
> >>> + if (str != null) {
> >>> + try {
> >>> + Integer.valueOf(str);
> >
> > What is this line doing? The return value is just thrown away.
> > If that's deliberate, at least document it.
> >
> 
> Integer.valueOf throws an Exception (NumberFormatException to be
> precise) if the input can not be parsed as a number. That said, since
> we
> are already doing Integer.valueOf (on oldString + str) on the next
> line,
> perhaps this line can be removed completely?

Yes, you are right we can remove that line completely.

Cheers,
  Andrew



More information about the distro-pkg-dev mailing list