Author: rwinston Date: Thu Mar 29 08:37:00 2007 New Revision: 523750 URL: http://svn.apache.org/viewvc?view=rev&rev=523750 Log: Fix NET-155
Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/ExtendedNNTPOps.java jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/MessageThreading.java jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/NNTPUtils.java jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NNTPClient.java jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/site/xdoc/changes.xml Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/ExtendedNNTPOps.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/ExtendedNNTPOps.java?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/ExtendedNNTPOps.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/ExtendedNNTPOps.java Thu Mar 29 08:37:00 2007 @@ -57,8 +57,8 @@ // XOVER NewsgroupInfo testGroup = new NewsgroupInfo(); client.selectNewsgroup("alt.test", testGroup); - int lowArticleNumber = testGroup.getFirstArticle(); - int highArticleNumber = lowArticleNumber + 100; + long lowArticleNumber = testGroup.getFirstArticle(); + long highArticleNumber = lowArticleNumber + 100; Article[] articles = NNTPUtils.getArticleInfo(client, lowArticleNumber, highArticleNumber); for (int i = 0; i < articles.length; ++i) { Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/MessageThreading.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/MessageThreading.java?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/MessageThreading.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/MessageThreading.java Thu Mar 29 08:37:00 2007 @@ -54,8 +54,8 @@ NewsgroupInfo group = new NewsgroupInfo(); client.selectNewsgroup("comp.lang.lisp", group); - int lowArticleNumber = group.getFirstArticle(); - int highArticleNumber = lowArticleNumber + 100; + long lowArticleNumber = group.getFirstArticle(); + long highArticleNumber = lowArticleNumber + 100; System.out.println("Retrieving articles between [" + lowArticleNumber + "] and [" + highArticleNumber + "]"); Article[] articles = NNTPUtils.getArticleInfo(client, lowArticleNumber, highArticleNumber); Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/NNTPUtils.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/NNTPUtils.java?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/NNTPUtils.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/examples/nntp/NNTPUtils.java Thu Mar 29 08:37:00 2007 @@ -42,7 +42,7 @@ * @return Article[] An array of Article * @throws IOException */ - public static Article[] getArticleInfo(NNTPClient client, int lowArticleNumber, int highArticleNumber) + public static Article[] getArticleInfo(NNTPClient client, long lowArticleNumber, long highArticleNumber) throws IOException { Reader reader = null; Article[] articles = null; Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NNTPClient.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NNTPClient.java?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NNTPClient.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NNTPClient.java Thu Mar 29 08:37:00 2007 @@ -176,7 +176,7 @@ { NewsgroupInfo result; StringTokenizer tokenizer; - int lastNum, firstNum; + long lastNum, firstNum; String last, first, permission; result = new NewsgroupInfo(); @@ -192,8 +192,8 @@ try { - lastNum = Integer.parseInt(last); - firstNum = Integer.parseInt(first); + lastNum = Long.valueOf(last); + firstNum = Long.valueOf(first); result._setFirstArticle(firstNum); result._setLastArticle(lastNum); @@ -1212,8 +1212,8 @@ * @return a DotTerminatedReader if successful, null otherwise * @throws IOException */ - public Reader retrieveArticleInfo(int lowArticleNumber, - int highArticleNumber) + public Reader retrieveArticleInfo(long lowArticleNumber, + long highArticleNumber) throws IOException { return Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java Thu Mar 29 08:37:00 2007 @@ -32,124 +32,118 @@ * @see NNTPClient ***/ -public final class NewsgroupInfo -{ - /*** - * A constant indicating that the posting permission of a newsgroup is - * unknown. For example, the NNTP GROUP command does not return posting - * information, so NewsgroupInfo instances obtained from that command - * willhave an UNKNOWN_POSTING_PERMISSION. - ***/ - public static final int UNKNOWN_POSTING_PERMISSION = 0; - - /*** A constant indicating that a newsgroup is moderated. ***/ - public static final int MODERATED_POSTING_PERMISSION = 1; - - /*** A constant indicating that a newsgroup is public and unmoderated. ***/ - public static final int PERMITTED_POSTING_PERMISSION = 2; - - /*** - * A constant indicating that a newsgroup is closed for general posting. - ***/ - public static final int PROHIBITED_POSTING_PERMISSION = 3; - - private String __newsgroup; - private int __estimatedArticleCount; - private int __firstArticle, __lastArticle; - private int __postingPermission; - - void _setNewsgroup(String newsgroup) - { - __newsgroup = newsgroup; - } - - void _setArticleCount(int count) - { - __estimatedArticleCount = count; - } - - void _setFirstArticle(int first) - { - __firstArticle = first; - } - - void _setLastArticle(int last) - { - __lastArticle = last; - } - - void _setPostingPermission(int permission) - { - __postingPermission = permission; - } - - /*** - * Get the newsgroup name. - * <p> - * @return The name of the newsgroup. - ***/ - public String getNewsgroup() - { - return __newsgroup; - } - - /*** - * Get the estimated number of articles in the newsgroup. The - * accuracy of this value will depend on the server implementation. - * <p> - * @return The estimated number of articles in the newsgroup. - ***/ - public int getArticleCount() - { - return __estimatedArticleCount; - } - - /*** - * Get the number of the first article in the newsgroup. - * <p> - * @return The number of the first article in the newsgroup. - ***/ - public int getFirstArticle() - { - return __firstArticle; - } - - /*** - * Get the number of the last article in the newsgroup. - * <p> - * @return The number of the last article in the newsgroup. - ***/ - public int getLastArticle() - { - return __lastArticle; - } - - /*** - * Get the posting permission of the newsgroup. This will be one of - * the <code> POSTING_PERMISSION </code> constants. - * <p> - * @return The posting permission status of the newsgroup. - ***/ - public int getPostingPermission() - { - return __postingPermission; - } - - /* - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.append(__newsgroup); - buffer.append(' '); - buffer.append(__lastArticle); - buffer.append(' '); - buffer.append(__firstArticle); - buffer.append(' '); - switch(__postingPermission) { - case 1: buffer.append('m'); break; - case 2: buffer.append('y'); break; - case 3: buffer.append('n'); break; - } - return buffer.toString(); -} - */ +public final class NewsgroupInfo { + /*** + * A constant indicating that the posting permission of a newsgroup is + * unknown. For example, the NNTP GROUP command does not return posting + * information, so NewsgroupInfo instances obtained from that command + * willhave an UNKNOWN_POSTING_PERMISSION. + ***/ + public static final int UNKNOWN_POSTING_PERMISSION = 0; + + /*** A constant indicating that a newsgroup is moderated. ***/ + public static final int MODERATED_POSTING_PERMISSION = 1; + + /*** A constant indicating that a newsgroup is public and unmoderated. ***/ + public static final int PERMITTED_POSTING_PERMISSION = 2; + + /*** + * A constant indicating that a newsgroup is closed for general posting. + ***/ + public static final int PROHIBITED_POSTING_PERMISSION = 3; + + private String __newsgroup; + private long __estimatedArticleCount; + private long __firstArticle, __lastArticle; + private int __postingPermission; + + void _setNewsgroup(String newsgroup) { + __newsgroup = newsgroup; + } + + void _setArticleCount(long count) { + __estimatedArticleCount = count; + } + + void _setFirstArticle(long first) { + __firstArticle = first; + } + + void _setLastArticle(long last) { + __lastArticle = last; + } + + void _setPostingPermission(int permission) { + __postingPermission = permission; + } + + /*** + * Get the newsgroup name. + * <p> + * @return The name of the newsgroup. + ***/ + public String getNewsgroup() { + return __newsgroup; + } + + /*** + * Get the estimated number of articles in the newsgroup. The + * accuracy of this value will depend on the server implementation. + * <p> + * @return The estimated number of articles in the newsgroup. + ***/ + public long getArticleCount() { + return __estimatedArticleCount; + } + + /*** + * Get the number of the first article in the newsgroup. + * <p> + * @return The number of the first article in the newsgroup. + ***/ + public long getFirstArticle() { + return __firstArticle; + } + + /*** + * Get the number of the last article in the newsgroup. + * <p> + * @return The number of the last article in the newsgroup. + ***/ + public long getLastArticle() { + return __lastArticle; + } + + /*** + * Get the posting permission of the newsgroup. This will be one of + * the <code> POSTING_PERMISSION </code> constants. + * <p> + * @return The posting permission status of the newsgroup. + ***/ + public int getPostingPermission() { + return __postingPermission; + } + + public String toString() { + StringBuilder buffer = new StringBuilder(); + buffer.append(__newsgroup); + buffer.append(' '); + buffer.append(__lastArticle); + buffer.append(' '); + buffer.append(__firstArticle); + buffer.append(' '); + switch (__postingPermission) { + case 1: + buffer.append('m'); + break; + case 2: + buffer.append('y'); + break; + case 3: + buffer.append('n'); + break; + } + return buffer.toString(); + } + } Modified: jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/site/xdoc/changes.xml?view=diff&rev=523750&r1=523749&r2=523750 ============================================================================== --- jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/site/xdoc/changes.xml (original) +++ jakarta/commons/proper/net/branches/JDK_1_5_BRANCH/src/site/xdoc/changes.xml Thu Mar 29 08:37:00 2007 @@ -23,6 +23,9 @@ <body> <release version="2.0" date="" description="Java 5.0 release"> + <action dev="rwinston" type="update" issue="NET-155"> + Change NNTPClient/NewsgroupInfo article counts from int to long + </action> <action dev="rwinston" type="update" issue="NET-151"> Add support for explictly overriding destination hosts for passive sessions. Thanks to <[EMAIL PROTECTED]> </action> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]