Author: bago
Date: Sat Apr  8 12:44:05 2006
New Revision: 392598

URL: http://svn.apache.org/viewcvs?rev=392598&view=rev
Log:
Fixed a critical bug using dbfile since I introduced the direct stream to db 
(JAMES-475)

Modified:
    
james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java

Modified: 
james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java?rev=392598&r1=392597&r2=392598&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java
 Sat Apr  8 12:44:05 2006
@@ -51,7 +51,9 @@
         caughtException = null;
         streamRep = srep;
         size = mc.getMessageSize();
-        if (size > 4096) {
+        // we use the pipes only when streamRep is null and the message size 
is greater than 4096
+        // Otherwise we should calculate the header size and not the message 
size when streamRep is not null (JAMES-475)
+        if (streamRep == null && size > 4096) {
             PipedOutputStream headerOut = new PipedOutputStream();
             new Thread() {
                 private Mail mail;
@@ -79,6 +81,7 @@
             ByteArrayOutputStream headerOut = new ByteArrayOutputStream();
             writeStream(mc,headerOut);
             wrapped = new ByteArrayInputStream(headerOut.toByteArray());
+            size = headerOut.size();
         }
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to