savannah-hackers
[Top][All Lists]
Advanced

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

[Savannah-hackers] [support #103037] Bug in Revision 1.3 of gnu/inet/nnt


From: Sylvain Beucler
Subject: [Savannah-hackers] [support #103037] Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java
Date: Thu, 29 Apr 2004 14:19:04 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8

This mail is an automated notification from the support tracker
 of the project: Savannah Administration.

/**************************************************************************/
[support #103037] Latest Modifications:

Changes by: 
                Sylvain Beucler <address@hidden>
'Date: 
                Thu 04/29/04 at 18:18 (Europe/Paris)

            What     | Removed                   | Added
---------------------------------------------------------------------------
              Status | Open                      | Closed


------------------ Additional Follow-up Comments ----------------------------
This is the support for Savannah administration.
Please address this request to the appropriate project tracker or
mailing-list.







/**************************************************************************/
[support #103037] Full Item Snapshot:

URL: <http://savannah.gnu.org/support/?func=detailitem&item_id=103037>
Project: Savannah Administration
Submitted by: Bodo Weiss
On: Thu 04/29/04 at 17:15

Category:  None
Priority:  5 - Normal
Severity:  5 - Average
Resolution:  Invalid
Assigned to:  None
Originator Email:  address@hidden
Status:  Closed


Summary:  Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java

Original Submission:  The method listGroup uses the wrong constant in the first 
line of the
methods body
LIST_NEWSGROUPS = "LIST NEWSGROUPS" 
LISTGROUP = "LISTGROUP" 

public ArticleNumberIterator listGroup(String group) throws IOException
  {
    // was StringBuffer buffer = new StringBuffer(LIST_NEWSGROUPS);
    StringBuffer buffer = new StringBuffer(LISTGROUP);
    if (group != null)
    {
      buffer.append(' ');
      buffer.append(group);
    }
    send(buffer.toString());
    StatusResponse response = parseResponse(read());
    switch (response.status)
    {
      case GROUP_SELECTED:
        ArticleNumberIterator ani = new ArticleNumberIterator(this);
        pendingData = ani;
        return ani;
      default:
        throw new NNTPException(response);
    }
  }

After this bug is solved, there is a new problem.
The command LISTGROUP returns this String from my NNTP-Server 
    211 Article list follows
This string cause the method parseResponse to throw a
NumberFormatException. Catching the NumberFormatException solves the bug for me.



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

Follow-up Comments
------------------


-------------------------------------------------------
Date: Thu 04/29/04 at 18:18         By: Beuc
This is the support for Savannah administration.
Please address this request to the appropriate project tracker or
mailing-list.


-------------------------------------------------------
Date: Thu 04/29/04 at 18:18         By: Beuc
This is the support for Savannah administration.
Please address this request to the appropriate project tracker or
mailing-list.





CC List
-------

CC Address                          | Comment
------------------------------------+-----------------------------
bodoweiss                           | 









For detailed info, follow this link:
<http://savannah.gnu.org/support/?func=detailitem&item_id=103037>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

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