I am using Commons Net 1.2.2
When you ask for the list of newsgroups of a NNTP Server, the framework doesn't
calculate correctly the total article count when that specific newsgroup has no
articles.
For example, the NNTP Server answers something like this:
org.javahispano.j2ee 0 0 y
then, debugging the source code of class:
org.apache.commons.net.nntp.NNTPClient
I found the problem in method:
private NewsgroupInfo __parseNewsgroupListEntry(String entry)
where it does:
...
result._setNewsgroup(tokenizer.nextToken());
last = tokenizer.nextToken();
first = tokenizer.nextToken();
permission = tokenizer.nextToken();
try
{
lastNum = Integer.parseInt(last);
firstNum = Integer.parseInt(first);
result._setFirstArticle(firstNum);
result._setLastArticle(lastNum);
result._setArticleCount(lastNum - firstNum + 1);
}
catch (NumberFormatException e)
{
return null;
}
The proble is in this line:
result._setArticleCount(lastNum - firstNum + 1);
where if lastNum is 0 and firstNum is 0, it sais that the newsgroup has 1
article. I understand the code should add a control line where it double check
if lastNum and firstNum are 0. Right?