
Eigenschaftsänderungen: imap
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target



Eigenschaftsänderungen: api
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target


Index: pom.xml
===================================================================
--- pom.xml	(Revision 5719)
+++ pom.xml	(Revision 5832)
@@ -23,7 +23,7 @@
     <parent>
         <artifactId>james-project</artifactId>
         <groupId>org.apache.james</groupId>
-        <version>1.8.1</version>
+        <version>1.8.2</version>
         <relativePath />
     </parent>
 
@@ -48,18 +48,19 @@
     <properties>
         <target.jdk>1.6</target.jdk>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <netty.version>3.3.1.Final</netty.version>
+        <netty.version>3.9.1.Final</netty.version>
         <apache-mime4j.version>0.7.2</apache-mime4j.version>
-        <mailbox.version>0.5</mailbox.version>
+        <mailbox.version>0.6-SNAPSHOT</mailbox.version>
         <commons-net.version>3.2</commons-net.version>
         <commons-lang.version>2.6</commons-lang.version>
         <commons-codec.version>1.7</commons-codec.version>
         <commons-collections.version>3.2.1</commons-collections.version>
+        <commons-io.version>2.4</commons-io.version>
         <jmock.version>2.5.1</jmock.version>
         <jutf7.version>1.0.0</jutf7.version>
-        <junit.version>4.10</junit.version>
+        <junit.version>4.11</junit.version>
         <geronimo-javamail.version>1.8.3</geronimo-javamail.version>
-        <slf4j.version>1.6.3</slf4j.version>
+        <slf4j.version>1.7.2</slf4j.version>
     </properties>
 
     <dependencyManagement>
@@ -196,10 +197,23 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
+                <groupId>commons-io</groupId>
+                <artifactId>commons-io</artifactId>
+                <version>${commons-io.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.geronimo.javamail</groupId>
                 <artifactId>geronimo-javamail_1.4_mail</artifactId>
                 <version>${geronimo-javamail.version}</version>
             </dependency>
+            
+            <!-- dependency convergence fix: -->
+            <dependency>
+                <groupId>org.hamcrest</groupId>
+                <artifactId>hamcrest-core</artifactId>
+                <version>1.3</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -208,10 +222,12 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.3.7</version>
                 <extensions>true</extensions>
             </plugin>
             <plugin>
+                <artifactId>maven-enforcer-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-clean-plugin</artifactId>
                 <configuration>
@@ -234,8 +250,56 @@
                         </goals>
                     </execution>
                 </executions>
+                <configuration>
+                    <!-- avoid race with bundle plugin manifest (known bug): -->
+                    <useDefaultManifestFile>true</useDefaultManifestFile>
+                </configuration>
             </plugin>
         </plugins>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-dependency-plugin</artifactId>
+                    <version>2.8</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>2.4</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-shade-plugin</artifactId>
+                    <version>2.2</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>2.4.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <version>1.3.1</version>
+                    <executions>
+                        <execution>
+                            <id>enforce-sane-versions</id>
+                            <goals>
+                                <goal>enforce</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <rules>
+                            <requirePluginVersions />
+                            <dependencyConvergence />
+                            <requireUpperBoundDeps />
+                            <requireReleaseDeps>
+                                <message>No Snapshots Allowed!</message>
+                                <onlyWhenRelease>true</onlyWhenRelease>
+                            </requireReleaseDeps>
+                        </rules>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>                
     </build>
 
     <scm>
Index: lmtp/pom.xml
===================================================================
--- lmtp/pom.xml	(Revision 5719)
+++ lmtp/pom.xml	(Revision 5832)
@@ -53,6 +53,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.james.protocols</groupId>
             <artifactId>protocols-netty</artifactId>
             <scope>test</scope>

Eigenschaftsänderungen: lmtp
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target


Index: pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java
===================================================================
--- pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java	(Revision 5719)
+++ pop3/src/test/java/org/apache/james/protocols/pop3/AbstractPOP3ServerTest.java	(Revision 5832)
@@ -476,7 +476,7 @@
             String welcomeMessage = client.getReplyString();
             
             // check for valid syntax that include all info needed for APOP
-            assertTrue(welcomeMessage.trim().matches("\\+OK \\<\\d+\\.\\d+@.+\\> .+"));
+            assertTrue(welcomeMessage.trim().matches("\\+OK \\<-?\\d+\\.\\d+@.+\\> .+"));
             
             int reply = client.sendCommand("APOP invalid invalid");
             assertEquals(POP3Reply.ERROR, reply);

Eigenschaftsänderungen: pop3
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target



Eigenschaftsänderungen: netty
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target


Index: smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
===================================================================
--- smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java	(Revision 5719)
+++ smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java	(Revision 5832)
@@ -26,7 +26,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
-
+import java.util.regex.Pattern;
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.net.smtp.SMTPClient;
 import org.apache.commons.net.smtp.SMTPReply;
 import org.apache.james.protocols.api.Protocol;
@@ -45,8 +46,8 @@
 import org.apache.james.protocols.smtp.hook.MessageHook;
 import org.apache.james.protocols.smtp.hook.RcptHook;
 import org.apache.james.protocols.smtp.utils.TestMessageHook;
+import static org.junit.Assert.*;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 public abstract class AbstractSMTPServerTest {
     
@@ -105,6 +106,75 @@
     }
     
     @Test
+    public void testReceivedHeader() throws Exception {
+        TestMessageHook hook = new TestMessageHook();
+        InetSocketAddress address = new InetSocketAddress("127.0.0.1", TestUtils.getFreePort());
+        
+        ProtocolServer server = null;
+        try {
+            server = createServer(createProtocol(hook), address);  
+            server.bind();
+            
+            SMTPClient client = createClient();
+            client.connect(address.getAddress().getHostAddress(), address.getPort());
+            assertTrue(SMTPReply.isPositiveCompletion(client.getReplyCode()));
+            
+            client.helo("localhost");
+            client.setSender(SENDER);
+            client.addRecipient(RCPT1);
+            assertTrue(client.sendShortMessageData(MSG1));
+            client.quit();
+            client.disconnect();
+
+            MailEnvelope env = hook.getQueued().iterator().next();
+            List<String> lines = IOUtils.readLines(env.getMessageInputStream());
+            assertTrue("first line is Received header",
+                    lines.get(0).toLowerCase().startsWith("received:"));
+        } finally {
+            if (server != null) {
+                server.unbind();
+            }
+        }
+        
+    }
+    
+    @Test
+    public void testEmptyMessageReceivedHeaderJames1547() throws Exception {
+        TestMessageHook hook = new TestMessageHook();
+        InetSocketAddress address = new InetSocketAddress("127.0.0.1", TestUtils.getFreePort());
+        
+        ProtocolServer server = null;
+        try {
+            server = createServer(createProtocol(hook), address);  
+            server.bind();
+            
+            SMTPClient client = createClient();
+            client.connect(address.getAddress().getHostAddress(), address.getPort());
+            assertTrue(SMTPReply.isPositiveCompletion(client.getReplyCode()));
+            
+            client.helo("localhost");
+            client.setSender(SENDER);
+            client.addRecipient(RCPT1);
+            assertTrue(client.sendShortMessageData(""));
+            client.quit();
+            client.disconnect();
+
+            MailEnvelope env = hook.getQueued().iterator().next();
+            List<String> lines = IOUtils.readLines(env.getMessageInputStream());
+            assertTrue("first line is Received header",
+                    Pattern.compile("^received:").matcher(lines.get(0).toLowerCase()).find());
+            assertTrue("second last line is non-empty and starts with spaces",
+                    Pattern.compile("^ +\\S+").matcher(lines.get(lines.size()-2)).find());
+            assertEquals("last line is empty", "", lines.get(lines.size()-1));
+        } finally {
+            if (server != null) {
+                server.unbind();
+            }
+        }
+        
+    }
+    
+    @Test
     public void testStartTlsNotSupported() throws Exception {
         TestMessageHook hook = new TestMessageHook();
         InetSocketAddress address = new InetSocketAddress("127.0.0.1", TestUtils.getFreePort());
Index: smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractAddHeadersFilter.java
===================================================================
--- smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractAddHeadersFilter.java	(Revision 5719)
+++ smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractAddHeadersFilter.java	(Revision 5832)
@@ -57,10 +57,17 @@
     
     @Override
     protected Response onSeparatorLine(SMTPSession session, ByteBuffer line, LineHandler<SMTPSession> next) {
+        // fallback in case there is no header line:
+        if (getLocation() == Location.Prefix && session.getAttachment(headersPrefixAdded, State.Transaction) == null) {
+            session.setAttachment(headersPrefixAdded, Boolean.TRUE, State.Transaction);
+            return addHeaders(session, line, next);
+        }
+        
         if (getLocation() == Location.Suffix && session.getAttachment(headersSuffixAdded, State.Transaction) == null) { 
             session.setAttachment(headersSuffixAdded, Boolean.TRUE, State.Transaction);
             return addHeaders(session, line, next);
         }
+        
         return super.onSeparatorLine(session, line, next);
     }
 
Index: smtp/pom.xml
===================================================================
--- smtp/pom.xml	(Revision 5719)
+++ smtp/pom.xml	(Revision 5832)
@@ -70,6 +70,11 @@
             <artifactId>geronimo-javamail_1.4_mail</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

Eigenschaftsänderungen: smtp
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target



Eigenschaftsänderungen: .
___________________________________________________________________
Hinzugefügt: svn:ignore
   + target


