commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32152] New: - Problem calculating total article count
Date Wed, 10 Nov 2004 13:45:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32152>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32152

Problem calculating total article count

           Summary: Problem calculating total article count
           Product: Commons
           Version: 1.2 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jmordax@terra.es


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?

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message