james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harmeet Bedi" <harm...@kodemuse.com>
Subject Re: DO NOT REPLY [Bug 16664] New: - Cannot crosspost to multiple newsgroup servers.
Date Sat, 01 Feb 2003 09:19:24 GMT
This bug exists in 2.1 and 3.0. Here is a patch for your review

Index: NNTPSpooler.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTP
Spooler.java,v
retrieving revision 1.11.4.1
diff -u -r1.11.4.1 NNTPSpooler.java
--- NNTPSpooler.java 10 Jan 2003 08:30:16 -0000 1.11.4.1
+++ NNTPSpooler.java 1 Feb 2003 09:04:34 -0000
@@ -25,6 +25,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Properties;
+import java.util.StringTokenizer;

 /**
  * Processes entries and sends to appropriate groups.
@@ -289,21 +290,26 @@
             Properties prop = new Properties();
             if (headers != null) {
                 for ( int i = 0 ; i < headers.length ; i++ ) {
-                    getLogger().debug("Copying message to group:
"+headers[i]);
-                    NNTPGroup group = repo.getGroup(headers[i]);
-                    if ( group == null ) {
-                        getLogger().error("Couldn't add article with
article ID " + articleID + " to group " + headers[i] + " - group not
found.");
-                        continue;
-                    }
-
-                    FileInputStream newsStream = new
FileInputStream(spoolFile);
-                    try {
-                        NNTPArticle article = group.addArticle(newsStream);
-
prop.setProperty(group.getName(),article.getArticleNumber() + "");
-                    } finally {
+                    StringTokenizer tokenizer = new
StringTokenizer(headers[i],",");
+                    while ( tokenizer.hasMoreTokens() ) {
+                        String groupName = tokenizer.nextToken();
+                        getLogger().debug("Copying message to group:
"+groupName);
+                        NNTPGroup group = repo.getGroup(groupName);
+                        if ( group == null ) {
+                            getLogger().error("Couldn't add article with
article ID " + articleID +
+                                              " to group " + groupName +
" - group not found.");
+                            continue;
+                        }
+
+                        FileInputStream newsStream = new
FileInputStream(spoolFile);
                         try {
-                            newsStream.close();
-                        } catch (IOException _) { /* ignore close error
*/ }
+                            NNTPArticle article =
group.addArticle(newsStream);
+
prop.setProperty(group.getName(),article.getArticleNumber() + "");
+                        } finally {
+                            try {
+                                newsStream.close();
+                            } catch (IOException _) { /* ignore close error
*/ }
+                        }
                     }
                 }
             }



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


Mime
View raw message