savannah-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers] Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnecti


From: Sylvain Beucler
Subject: Re: [Savannah-hackers] Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java
Date: Wed, 28 Apr 2004 17:26:44 +0200

This is the list for the Savannah website.
Can you please repost your bug reports to the appropriate mailing list?

--
Sylvain


On 2004.04.28 11:44, address@hidden wrote:

Hi,

I found another bug in Revision 1.3 of
gnu/inet/nntp/NNTPConnection.java

the command LISTGROUP returns on my NNTP-Server this String
    211 Article list follows
This string cause the method parseResponse to throw a
NumberFormatException. Catching the NumberFormatException solves the
bug for me.

Please let me know the status of this bug.

Greetings

Bodo Weiss


  protected StatusResponse parseResponse(String line)
  {
    int start = 0, end;
    String statusText = line;
    String message = null;
    end = line.indexOf(' ', start);
    if (end > start)
    {
      statusText = line.substring(start, end);
      message = line.substring(end + 1);
    }
    short status = Short.parseShort(statusText);
    StatusResponse response;
    switch (status)
    {
      case ARTICLE_FOLLOWS:
      case HEAD_FOLLOWS:
      case BODY_FOLLOWS:
      case ARTICLE_RETRIEVED:
        try
        {
          ArticleResponse aresponse = new ArticleResponse(status,
message);
          // article number
          start = end + 1;
          end = line.indexOf(' ', start);
          if (end > start)
            aresponse.articleNumber =
              Integer.parseInt(line.substring(start, end));
          // message-id
          start = end + 1;
          end = line.indexOf(' ', start);
          if (end > start)
            aresponse.messageId = line.substring(start, end);
          else
            aresponse.messageId = line.substring(start);
          response = aresponse;
        }
        catch(NumberFormatException e)
        {
          // This will happen for XHDR
          response = new StatusResponse(status, message);
        }
        break;
      case GROUP_SELECTED:
                  GroupResponse gresponse = new GroupResponse(status,
message);
// Next line added
                try {
                        // count
                        start = end + 1;
                        end = line.indexOf(' ', start);
                        if (end > start)
gresponse.count = Integer.parseInt(line. substring(start,
end));
                        // first
                        start = end + 1;
                        end = line.indexOf(' ', start);
                        if (end > start)
gresponse.first = Integer.parseInt(line. substring(start,
end));
                        // last
                        start = end + 1;
                        end = line.indexOf(' ', start);
                        if (end > start)
gresponse.last = Integer.parseInt(line. substring(start,
end));
                        // group
                        start = end + 1;
                        end = line.indexOf(' ', start);
                        if (end > start)
                          gresponse.group = line.substring(start,
end);
                        else
                          gresponse.group = line.substring(start);
// Next line added
                } catch (NumberFormatException e1) {}
                response = gresponse;
        break;
      default:
        response = new StatusResponse(status, message);
    }
    return response;
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]