james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r931280 - in /james/imap/trunk: api/src/main/java/org/apache/james/imap/api/ decode/src/main/java/org/apache/james/imap/decode/base/ message/src/main/java/org/apache/james/imap/message/request/ processor/src/main/java/org/apache/james/imap/...
Date Tue, 06 Apr 2010 19:25:28 GMT
Author: norman
Date: Tue Apr  6 19:25:27 2010
New Revision: 931280

URL: http://svn.apache.org/viewvc?rev=931280&view=rev
Log:
No need to expose EolInputStream (IMAP-127)

Added:
    james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java
      - copied, changed from r931266, james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java
Modified:
    james/imap/trunk/api/src/main/java/org/apache/james/imap/api/ImapMessageFactory.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/AppendRequest.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/BaseImap4Rev1MessageFactory.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java

Modified: james/imap/trunk/api/src/main/java/org/apache/james/imap/api/ImapMessageFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/api/src/main/java/org/apache/james/imap/api/ImapMessageFactory.java?rev=931280&r1=931279&r2=931280&view=diff
==============================================================================
--- james/imap/trunk/api/src/main/java/org/apache/james/imap/api/ImapMessageFactory.java (original)
+++ james/imap/trunk/api/src/main/java/org/apache/james/imap/api/ImapMessageFactory.java Tue
Apr  6 19:25:27 2010
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.imap.api;
 
+import java.io.InputStream;
 import java.util.Date;
 
 import javax.mail.Flags;
@@ -28,7 +29,6 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.message.StatusDataItems;
 import org.apache.james.imap.api.message.request.SearchKey;
 import org.apache.james.imap.api.message.response.StatusResponse;
-import org.apache.james.imap.decode.base.EolInputStream;
 
 /**
  * Creates messages. Implementations may support message pooling but this is not
@@ -54,7 +54,7 @@ public interface ImapMessageFactory {
 
     public ImapMessage createAppendMessage(ImapCommand command,
             String mailboxName, Flags flags, Date datetime,
-            EolInputStream message, String tag);
+            InputStream message, String tag);
 
     public ImapMessage createAuthenticateMessage(final ImapCommand command,
             final String authType, final String tag);

Copied: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java
(from r931266, james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java)
URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java?p2=james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java&p1=james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java&r1=931266&r2=931280&rev=931280&view=diff
==============================================================================
--- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java
(original)
+++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/base/EolInputStream.java
Tue Apr  6 19:25:27 2010
@@ -67,14 +67,4 @@ public class EolInputStream extends Filt
         }
     }
     
-    /**
-     * Consume the whole stream
-     */
-    public void cosume() { 
-        try {
-            while (read() != -1);
-        } catch (IOException e) {
-            // do nothing here
-        }
-    }
 }

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/AppendRequest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/AppendRequest.java?rev=931280&r1=931279&r2=931280&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/AppendRequest.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/AppendRequest.java
Tue Apr  6 19:25:27 2010
@@ -18,12 +18,13 @@
  ****************************************************************/
 package org.apache.james.imap.message.request;
 
+import java.io.InputStream;
 import java.util.Date;
 
 import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.decode.base.EolInputStream;
+
 
 public class AppendRequest extends AbstractImapRequest {
     private final String mailboxName;
@@ -32,10 +33,10 @@ public class AppendRequest extends Abstr
 
     private final Date datetime;
 
-    private final EolInputStream message;
+    private final InputStream message;
 
     public AppendRequest(ImapCommand command, String mailboxName, Flags flags,
-            Date datetime, EolInputStream message, String tag) {
+            Date datetime, InputStream message, String tag) {
         super(tag, command);
         this.mailboxName = mailboxName;
         this.flags = flags;
@@ -55,7 +56,7 @@ public class AppendRequest extends Abstr
         return mailboxName;
     }
 
-    public EolInputStream getMessage() {
+    public InputStream getMessage() {
         return message;
     }
     

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/BaseImap4Rev1MessageFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/BaseImap4Rev1MessageFactory.java?rev=931280&r1=931279&r2=931280&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/BaseImap4Rev1MessageFactory.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/message/request/BaseImap4Rev1MessageFactory.java
Tue Apr  6 19:25:27 2010
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.imap.message.request;
 
+import java.io.InputStream;
 import java.util.Date;
 
 import javax.mail.Flags;
@@ -32,7 +33,6 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.message.request.SearchKey;
 import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
-import org.apache.james.imap.decode.base.EolInputStream;
 
 /**
  * Naive, factory creates unpooled instances.
@@ -49,7 +49,7 @@ public class BaseImap4Rev1MessageFactory
 
     public ImapMessage createAppendMessage(ImapCommand command,
             String mailboxName, Flags flags, Date datetime,
-            EolInputStream message, String tag) {
+            InputStream message, String tag) {
         return new AppendRequest(command, mailboxName, flags, datetime,
                 message, tag);
     }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java?rev=931280&r1=931279&r2=931280&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
Tue Apr  6 19:25:27 2010
@@ -19,6 +19,7 @@
 
 package org.apache.james.imap.processor;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
 
@@ -34,7 +35,6 @@ import org.apache.james.imap.api.message
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
-import org.apache.james.imap.decode.base.EolInputStream;
 import org.apache.james.imap.mailbox.Mailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
@@ -63,7 +63,7 @@ public class AppendProcessor extends Abs
             String tag, ImapCommand command, Responder responder) {
         final AppendRequest request = (AppendRequest) message;
         final String mailboxName = request.getMailboxName();
-        final EolInputStream messageIn = request.getMessage();
+        final InputStream messageIn = request.getMessage();
         final Date datetime = request.getDatetime();
         final Flags flags = request.getFlags();
         try {
@@ -75,7 +75,11 @@ public class AppendProcessor extends Abs
                     command, mailbox, responder, fullMailboxName);
         } catch (MailboxNotFoundException e) {
             // consume stream
-            messageIn.cosume();
+            try {
+                while(messageIn.read() != -1);
+            } catch (IOException e1) {
+                // just consume
+            }
             
 //          Indicates that the mailbox does not exist
 //          So TRY CREATE



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


Mime
View raw message