mainSavannah Administration - Support: sr #103037, Bug in Revision 1.3 of...

 
 

sr #103037: Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java

Submitter:  Bodo Weiss <bodoweiss>
Submitted:  Thu 29 Apr 2004 05:15:42 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Operating System:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 29 Apr 2004 06:18:51 PM UTC, comment #2: 

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

Sylvain Beucler <Beuc>
Thu 29 Apr 2004 06:18:44 PM UTC, comment #1: 

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

Sylvain Beucler <Beuc>
Thu 29 Apr 2004 05:15:42 PM UTC, 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;
  }

Bodo Weiss <bodoweiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-04-29 Beuc Open/ClosedOpen Closed
2004-04-29 Beuc StatusNone Invalid
2004-04-29 bodoweiss Carbon-Copy- Added bodoweiss

Back to the top

Powered by Savane 3.13-bb6a.
Corresponding source code