noel 2003/02/01 13:02:16
Modified: src/java/org/apache/james/nntpserver/repository
NNTPSpooler.java
Log:
Update NNTPSpool. Fix Bug 16665. Synch file in v2.1 and HEAD
Revision Changes Path
1.16 +20 -15
jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
Index: NNTPSpooler.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- NNTPSpooler.java 18 Jan 2003 22:02:59 -0000 1.15
+++ NNTPSpooler.java 1 Feb 2003 21:02:16 -0000 1.16
@@ -26,6 +26,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
+import java.util.StringTokenizer;
/**
* Processes entries and sends to appropriate groups.
@@ -206,8 +207,8 @@
try {
while ( Thread.currentThread().interrupted() == false ) {
String[] list = spoolPath.list();
+ if (list.length > 0) getLogger().debug("Files to process:
"+list.length);
for ( int i = 0 ; i < list.length ; i++ ) {
- getLogger().debug("Files to process: "+list.length);
if ( lock.lock(list[i]) ) {
File f = new File(spoolPath,list[i]).getAbsoluteFile();
getLogger().debug("Processing file:
"+f.getAbsolutePath());
@@ -220,9 +221,9 @@
lock.unlock(list[i]);
}
}
- list[i] = null;
+ list[i] = null; // release the string entry;
}
- list = null;
+ list = null; // release the array;
// this is good for other non idle threads
try {
Thread.currentThread().sleep(threadIdleTime);
@@ -284,19 +285,23 @@
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;
- }
+ StringTokenizer tokenizer = new StringTokenizer(headers[i],",");
+ while ( tokenizer.hasMoreTokens() ) {
+ String groupName = tokenizer.nextToken().trim();
+ 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 {
- NNTPArticle article = group.addArticle(newsStream);
- prop.setProperty(group.getName(),article.getArticleNumber()
+ "");
- } finally {
- IOUtil.shutdownStream(newsStream);
+ FileInputStream newsStream = new FileInputStream(spoolFile);
+ try {
+ NNTPArticle article = group.addArticle(newsStream);
+
prop.setProperty(group.getName(),article.getArticleNumber() + "");
+ } finally {
+ IOUtil.shutdownStream(newsStream);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]