james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1150625 - in /james/jdkim/trunk: ./ assemble/src/assemble/ mailets/ mailets/src/main/java/org/apache/james/jdkim/mailets/ main/
Date Mon, 25 Jul 2011 10:42:49 GMT
Author: bago
Date: Mon Jul 25 10:42:48 2011
New Revision: 1150625

URL: http://svn.apache.org/viewvc?rev=1150625&view=rev
Log:
upgrade to mime4j 0.7 final
remove of "src" assembly (it is already generated by our apache parent pom during release)
renamed LICENSE/NOTICE to remove the .txt extension (so the source package from the parent
pom is ok)
removed sun's javamail dependency in favor of geronimo deps, so we can build without external
repositories.
created a CRLFOutputStream (copied from the one in james-mailbox, previously in server/util/stream)
so to not use the one from javamail com.sun package anymore.

Added:
    james/jdkim/trunk/LICENSE
      - copied unchanged from r1147805, james/jdkim/trunk/LICENSE.txt
    james/jdkim/trunk/NOTICE
      - copied unchanged from r1147805, james/jdkim/trunk/NOTICE.txt
    james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
  (with props)
Removed:
    james/jdkim/trunk/LICENSE.txt
    james/jdkim/trunk/NOTICE.txt
Modified:
    james/jdkim/trunk/assemble/src/assemble/bin.xml
    james/jdkim/trunk/mailets/pom.xml
    james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java
    james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMVerify.java
    james/jdkim/trunk/main/pom.xml
    james/jdkim/trunk/pom.xml

Modified: james/jdkim/trunk/assemble/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/assemble/src/assemble/bin.xml?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/assemble/src/assemble/bin.xml (original)
+++ james/jdkim/trunk/assemble/src/assemble/bin.xml Mon Jul 25 10:42:48 2011
@@ -29,8 +29,8 @@
       <directory>..</directory>
       <outputDirectory>/</outputDirectory>
       <includes>
-        <include>LICENSE.*</include>
-        <include>NOTICE.*</include>
+        <include>LICENSE</include>
+        <include>NOTICE</include>
         <include>RELEASE_NOTES.txt</include>
       </includes>
     </fileSet>

Modified: james/jdkim/trunk/mailets/pom.xml
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/mailets/pom.xml?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/mailets/pom.xml (original)
+++ james/jdkim/trunk/mailets/pom.xml Mon Jul 25 10:42:48 2011
@@ -90,12 +90,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>javax.mail</groupId>
-            <artifactId>mail</artifactId>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-activation_1.1_spec</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.activation</groupId>
-            <artifactId>activation</artifactId>
+            <groupId>org.apache.geronimo.javamail</groupId>
+            <artifactId>geronimo-javamail_1.4_mail</artifactId>
         </dependency>
         <dependency>
             <groupId>ca.juliusdavies</groupId>

Added: james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java?rev=1150625&view=auto
==============================================================================
--- james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
(added)
+++ james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
Mon Jul 25 10:42:48 2011
@@ -0,0 +1,161 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jdkim.mailets;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A Filter for use with SMTP or other protocols in which lines must end with
+ * CRLF. Converts every "isolated" occourency of \r or \n with \r\n
+ * 
+ * RFC 2821 #2.3.7 mandates that line termination is CRLF, and that CR and LF
+ * must not be transmitted except in that pairing. If we get a naked LF, convert
+ * to CRLF.
+ * 
+ */
+public class CRLFOutputStream extends FilterOutputStream {
+
+    /**
+     * Counter for number of last (0A or 0D).
+     */
+    protected int statusLast;
+
+    protected final static int LAST_WAS_OTHER = 0;
+
+    protected final static int LAST_WAS_CR = 1;
+
+    protected final static int LAST_WAS_LF = 2;
+
+    protected boolean startOfLine = true;
+
+    /**
+     * Constructor that wraps an OutputStream.
+     * 
+     * @param out
+     *            the OutputStream to be wrapped
+     */
+    public CRLFOutputStream(OutputStream out) {
+        super(out);
+        statusLast = LAST_WAS_LF; // we already assume a CRLF at beginning
+        // (otherwise TOP would not work correctly
+        // !)
+    }
+
+    /**
+     * Writes a byte to the stream Fixes any naked CR or LF to the RFC 2821
+     * mandated CFLF pairing.
+     * 
+     * @param b
+     *            the byte to write
+     * 
+     * @throws IOException
+     *             if an error occurs writing the byte
+     */
+    public void write(int b) throws IOException {
+        switch (b) {
+            case '\r':
+                out.write('\r');
+                out.write('\n');
+                startOfLine = true;
+                statusLast = LAST_WAS_CR;
+                break;
+            case '\n':
+                if (statusLast != LAST_WAS_CR) {
+                    out.write('\r');
+                    out.write('\n');
+                    startOfLine = true;
+                }
+                statusLast = LAST_WAS_LF;
+                break;
+            default:
+                // we're no longer at the start of a line
+                out.write(b);
+                startOfLine = false;
+                statusLast = LAST_WAS_OTHER;
+                break;
+        }
+    }
+
+    /**
+     * Provides an extension point for ExtraDotOutputStream to be able to add
+     * dots at the beginning of new lines.
+     * 
+     * @see java.io.FilterOutputStream#write(byte[], int, int)
+     */
+    protected void writeChunk(byte buffer[], int offset, int length)
+            throws IOException {
+        out.write(buffer, offset, length);
+    }
+
+    /**
+     * @see java.io.FilterOutputStream#write(byte[], int, int)
+     */
+    public synchronized void write(byte buffer[], int offset, int length)
+            throws IOException {
+        /* optimized */
+        int lineStart = offset;
+        for (int i = offset; i < length + offset; i++) {
+            switch (buffer[i]) {
+                case '\r':
+                    // CR case. Write down the last line
+                    // and position the new lineStart at the next char
+                    writeChunk(buffer, lineStart, i - lineStart);
+                    out.write('\r');
+                    out.write('\n');
+                    startOfLine = true;
+                    lineStart = i + 1;
+                    statusLast = LAST_WAS_CR;
+                    break;
+                case '\n':
+                    if (statusLast != LAST_WAS_CR) {
+                        writeChunk(buffer, lineStart, i - lineStart);
+                        out.write('\r');
+                        out.write('\n');
+                        startOfLine = true;
+                    }
+                    lineStart = i + 1;
+                    statusLast = LAST_WAS_LF;
+                    break;
+                default:
+                    statusLast = LAST_WAS_OTHER;
+            }
+        }
+        if (length + offset > lineStart) {
+            writeChunk(buffer, lineStart, length + offset - lineStart);
+            startOfLine = false;
+        }
+    }
+
+    /**
+     * Ensure that the stream is CRLF terminated.
+     * 
+     * @throws IOException
+     *             if an error occurs writing the byte
+     */
+    public void checkCRLFTerminator() throws IOException {
+        if (statusLast == LAST_WAS_OTHER) {
+            out.write('\r');
+            out.write('\n');
+            statusLast = LAST_WAS_CR;
+        }
+    }
+}

Propchange: james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java (original)
+++ james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java Mon
Jul 25 10:42:48 2011
@@ -44,8 +44,6 @@ import org.apache.james.jdkim.exceptions
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 
-import com.sun.mail.util.CRLFOutputStream;
-
 /**
  * This mailet sign a message using the DKIM protocol
  * If the privateKey is encoded using a password then you can pass

Modified: james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMVerify.java
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMVerify.java?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMVerify.java
(original)
+++ james/jdkim/trunk/mailets/src/main/java/org/apache/james/jdkim/mailets/DKIMVerify.java
Mon Jul 25 10:42:48 2011
@@ -34,8 +34,6 @@ import org.apache.james.jdkim.exceptions
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 
-import com.sun.mail.util.CRLFOutputStream;
-
 /**
  * This mailet verify a message using the DKIM protocol
  * 

Modified: james/jdkim/trunk/main/pom.xml
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/main/pom.xml?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/main/pom.xml (original)
+++ james/jdkim/trunk/main/pom.xml Mon Jul 25 10:42:48 2011
@@ -56,12 +56,12 @@
             <artifactId>junit</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.mail</groupId>
-            <artifactId>mail</artifactId>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-activation_1.1_spec</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.activation</groupId>
-            <artifactId>activation</artifactId>
+            <groupId>org.apache.geronimo.javamail</groupId>
+            <artifactId>geronimo-javamail_1.4_mail</artifactId>
         </dependency>
         <dependency>
             <groupId>commons-codec</groupId>

Modified: james/jdkim/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/jdkim/trunk/pom.xml?rev=1150625&r1=1150624&r2=1150625&view=diff
==============================================================================
--- james/jdkim/trunk/pom.xml (original)
+++ james/jdkim/trunk/pom.xml Mon Jul 25 10:42:48 2011
@@ -80,14 +80,14 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
-                <groupId>javax.mail</groupId>
-                <artifactId>mail</artifactId>
-                <version>1.4.1</version>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-activation_1.1_spec</artifactId>
+                <version>1.0.2</version>
             </dependency>
             <dependency>
-                <groupId>javax.activation</groupId>
-                <artifactId>activation</artifactId>
-                <version>1.1.1</version>
+                <groupId>org.apache.geronimo.javamail</groupId>
+                <artifactId>geronimo-javamail_1.4_mail</artifactId>
+                <version>1.6</version>
             </dependency>
             <dependency>
                 <groupId>commons-codec</groupId>
@@ -121,6 +121,16 @@
                 <groupId>org.apache.james</groupId>
                 <artifactId>apache-mailet-base</artifactId>
                 <version>1.1</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.mail</groupId>
+                        <artifactId>mail</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
@@ -128,6 +138,16 @@
                 <version>1.1</version>
                 <scope>test</scope>
                 <classifier>tests</classifier>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.mail</groupId>
+                        <artifactId>mail</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
@@ -135,11 +155,31 @@
                 <version>1.1</version>
                 <type>test-jar</type>
                 <scope>test</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.mail</groupId>
+                        <artifactId>mail</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
                 <artifactId>apache-mailet</artifactId>
                 <version>2.4</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.mail</groupId>
+                        <artifactId>mail</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>log4j</groupId>
@@ -150,7 +190,7 @@
             <dependency>
                 <groupId>dnsjava</groupId>
                 <artifactId>dnsjava</artifactId>
-                <version>2.0.8</version>
+                <version>2.1.1</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.james.jdkim</groupId>
@@ -177,12 +217,12 @@
             <dependency>
                 <groupId>org.apache.james</groupId>
                 <artifactId>apache-mime4j-core</artifactId>
-                <version>0.7-SNAPSHOT</version>
+                <version>0.7</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
                 <artifactId>apache-mime4j-dom</artifactId>
-                <version>0.7-SNAPSHOT</version>
+                <version>0.7</version>
             </dependency>
         </dependencies>
     </dependencyManagement>



---------------------------------------------------------------------
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