[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: |
Bodo Weiss |
Subject: |
[Savannah-hackers] [support #103037] Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java |
Date: |
Thu, 29 Apr 2004 13:15:43 -0400 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) |
This mail is an automated notification from the support tracker
of the project: Savannah Administration.
/**************************************************************************/
[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: None
Assigned to: None
Originator Email: address@hidden
Status: Open
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;
}
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/
- [Savannah-hackers] [support #103037] Bug in Revision 1.3 of gnu/inet/nntp/NNTPConnection.java,
Bodo Weiss <=