james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1457421 [1/2] - in /james/mime4j/trunk: ./ assemble/ benchmark/ core/ core/src/main/java/org/apache/james/mime4j/codec/ core/src/main/java/org/apache/james/mime4j/io/ core/src/main/java/org/apache/james/mime4j/stream/ core/src/test/java/or...
Date Sun, 17 Mar 2013 10:36:34 GMT
Author: ieugen
Date: Sun Mar 17 10:36:33 2013
New Revision: 1457421

URL: http://svn.apache.org/r1457421
Log:
MIME4J-221 Pom cleanup and IDE code analisys improvements

Modified:
    james/mime4j/trunk/assemble/pom.xml
    james/mime4j/trunk/benchmark/pom.xml
    james/mime4j/trunk/core/pom.xml
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/Base64InputStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/EncoderUtil.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableInputStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/ExampleMail.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64InputStreamTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64OutputStreamTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/CodecUtilTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableInputStreamTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStreamTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
    james/mime4j/trunk/dom/pom.xml
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/datetime/DateTime.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldLenientImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldLenientImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressBuilder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractEntity.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractHeader.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageServiceFactoryImpl.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
    james/mime4j/trunk/examples/pom.xml
    james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/LoggingMonitor.java
    james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
    james/mime4j/trunk/mbox/pom.xml
    james/mime4j/trunk/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/CharBufferWrapper.java
    james/mime4j/trunk/mbox/src/test/java/org/apache/james/mime4j/mboxiterator/MboxIteratorTest.java
    james/mime4j/trunk/pom.xml
    james/mime4j/trunk/storage/pom.xml
    james/mime4j/trunk/storage/src/main/java/org/apache/james/mime4j/storage/MemoryStorageProvider.java
    james/mime4j/trunk/storage/src/main/java/org/apache/james/mime4j/storage/StorageTextBody.java
    james/mime4j/trunk/storage/src/main/java/org/apache/james/mime4j/storage/TempFileStorageProvider.java

Modified: james/mime4j/trunk/assemble/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/assemble/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/assemble/pom.xml (original)
+++ james/mime4j/trunk/assemble/pom.xml Sun Mar 17 10:36:33 2013
@@ -17,7 +17,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -30,23 +31,20 @@
     <artifactId>apache-mime4j</artifactId>
     <packaging>pom</packaging>
 
-    <name>Apache JAMES Mime4j (Assembly)</name>
+    <name>Apache James :: Mime4j :: Assembly</name>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-core</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-examples</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-benchmark</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
@@ -65,41 +63,14 @@
                 </configuration>
                 <executions>
                     <execution>
-                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
-                        <phase>package</phase> <!-- append to the packaging phase. -->
+                        <id>make-assembly</id>
+                        <phase>package</phase>
                         <goals>
-                            <goal>attached</goal> <!-- goals == mojos -->
+                            <goal>attached</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     </build>
-    
-    <profiles>
-        <profile>
-            <id>site-reports</id>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <!--
-                            Disable generation of technical reports for 'pom' project, because
-                            of following problems:
-                            - site-plugin configuration can't be overwritten yet
-                              (https://jira.codehaus.org/browse/MSITE-484)
-                            - cobertura-plugin fails with NPE
-                              (http://jira.codehaus.org/browse/MCOBERTURA-148)
-                        -->
-                        <plugin>
-                            <groupId>org.apache.maven.plugins</groupId>
-                            <artifactId>maven-site-plugin</artifactId>
-                            <configuration>
-                                <generateReports>false</generateReports>
-                            </configuration>
-                        </plugin>
-                     </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-    </profiles>
 </project>
\ No newline at end of file

Modified: james/mime4j/trunk/benchmark/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/benchmark/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/benchmark/pom.xml (original)
+++ james/mime4j/trunk/benchmark/pom.xml Sun Mar 17 10:36:33 2013
@@ -17,7 +17,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -28,6 +29,7 @@
     </parent>
 
     <artifactId>apache-mime4j-benchmark</artifactId>
+    <packaging>bundle</packaging>
 
     <name>Apache JAMES Mime4j (Benchmarks)</name>
     <description>Benchmarks for MIME4J stream based MIME message parser</description>
@@ -36,12 +38,10 @@
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-dom</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-storage</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
@@ -50,8 +50,6 @@
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <optional>false</optional>
-            <scope>compile</scope>
         </dependency>
     </dependencies>
 </project>

Modified: james/mime4j/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/pom.xml (original)
+++ james/mime4j/trunk/core/pom.xml Sun Mar 17 10:36:33 2013
@@ -17,7 +17,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -28,22 +29,18 @@
     </parent>
 
     <artifactId>apache-mime4j-core</artifactId>
+    <packaging>bundle</packaging>
 
-    <name>Apache JAMES Mime4j (Core)</name>
+    <name>Apache James :: Mime4j :: Core</name>
 
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <type>jar</type>
-            <!-- Removed as a workaround for an unidentified M2 bug -->
-            <scope>test</scope>
-            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <scope>test</scope>
             <optional>true</optional>
         </dependency>
     </dependencies>

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/Base64InputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/Base64InputStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/Base64InputStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/Base64InputStream.java Sun Mar 17 10:36:33 2013
@@ -133,7 +133,6 @@ public class Base64InputStream extends I
     }
 
     private int read0(final byte[] buffer, final int off, final int len) throws IOException {
-        int from = off;
         int to = off + len;
         int index = off;
 
@@ -148,7 +147,7 @@ public class Base64InputStream extends I
         // eof or pad reached?
 
         if (eof)
-            return index == from ? EOF : index - from;
+            return index == off ? EOF : index - off;
 
         // decode into given buffer
 
@@ -168,7 +167,7 @@ public class Base64InputStream extends I
                         handleUnexpectedEof(sextets);
                     }
 
-                    return index == from ? EOF : index - from;
+                    return index == off ? EOF : index - off;
                 } else if (n > 0) {
                     position = 0;
                     size = n;
@@ -184,7 +183,7 @@ public class Base64InputStream extends I
 
                 if (value == BASE64_PAD) {
                     index = decodePad(data, sextets, buffer, index, to);
-                    return index - from;
+                    return index - off;
                 }
 
                 int decoded = BASE64_DECODE[value];
@@ -226,7 +225,7 @@ public class Base64InputStream extends I
                         }
 
                         assert index == to;
-                        return to - from;
+                        return to - off;
                     }
                 }
             }
@@ -234,7 +233,7 @@ public class Base64InputStream extends I
 
         assert sextets == 0;
         assert index == to;
-        return to - from;
+        return to - off;
     }
 
     private int decodePad(int data, int sextets, final byte[] buffer,

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java Sun Mar 17 10:36:33 2013
@@ -52,7 +52,7 @@ public class DecoderUtil {
             QuotedPrintableInputStream is = new QuotedPrintableInputStream(
                                                new ByteArrayInputStream(bytes), monitor);
 
-            int b = 0;
+            int b;
             while ((b = is.read()) != -1) {
                 baos.write(b);
             }
@@ -80,7 +80,7 @@ public class DecoderUtil {
             Base64InputStream is = new Base64InputStream(
                                         new ByteArrayInputStream(bytes), monitor);
 
-            int b = 0;
+            int b;
             while ((b = is.read()) != -1) {
                 baos.write(b);
             }
@@ -185,7 +185,7 @@ public class DecoderUtil {
             String encoding = matcher.group(3);
             String encodedText = matcher.group(4);
 
-            String decoded = null;
+            String decoded;
             decoded = tryDecodeEncodedWord(mimeCharset, encoding, encodedText, monitor, fallback);
             if (decoded == null) {
                 sb.append(matcher.group(0));

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/EncoderUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/EncoderUtil.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/EncoderUtil.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/EncoderUtil.java Sun Mar 17 10:36:33 2013
@@ -382,8 +382,8 @@ public class EncoderUtil {
         StringBuilder sb = new StringBuilder();
 
         final int end = bytes.length;
-        for (int idx = 0; idx < end; idx++) {
-            int v = bytes[idx] & 0xff;
+        for (byte aByte : bytes) {
+            int v = aByte & 0xff;
             if (v == 32) {
                 sb.append('_');
             } else if (!qChars.get(v)) {
@@ -540,8 +540,8 @@ public class EncoderUtil {
 
         int count = 0;
 
-        for (int idx = 0; idx < bytes.length; idx++) {
-            int v = bytes[idx] & 0xff;
+        for (byte aByte : bytes) {
+            int v = aByte & 0xff;
             if (v == 32) {
                 count++;
             } else if (!qChars.get(v)) {
@@ -586,8 +586,8 @@ public class EncoderUtil {
                 : Q_RESTRICTED_CHARS;
 
         int qEncoded = 0;
-        for (int i = 0; i < bytes.length; i++) {
-            int v = bytes[i] & 0xff;
+        for (byte aByte : bytes) {
+            int v = aByte & 0xff;
             if (v != 32 && !qChars.get(v)) {
                 qEncoded++;
             }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableInputStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableInputStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableInputStream.java Sun Mar 17 10:36:33 2013
@@ -141,7 +141,7 @@ public class QuotedPrintableInputStream 
             blanks.clear();
         } else if (blanks.length() > 0 && !keepblanks) {
             StringBuilder sb = new StringBuilder(blanks.length() * 3);
-            for (int i = 0; i < blanks.length(); i++) sb.append(" "+blanks.byteAt(i));
+            for (int i = 0; i < blanks.length(); i++) sb.append(" ").append(blanks.byteAt(i));
             if (monitor.warn("ignored blanks", sb.toString()))
                 throw new IOException("ignored blanks");
         }
@@ -157,7 +157,6 @@ public class QuotedPrintableInputStream 
 
     private int read0(final byte[] buffer, final int off, final int len) throws IOException {
         boolean eof = false;
-        int from = off;
         int to = off + len;
         int index = off;
 
@@ -178,7 +177,7 @@ public class QuotedPrintableInputStream 
 
             // end of stream?
             if (limit - pos == 0 && eof) {
-                return index == from ? -1 : index - from;
+                return index == off ? -1 : index - off;
             }
 
             boolean lastWasCR = false;
@@ -258,11 +257,11 @@ public class QuotedPrintableInputStream 
                 } else if (Character.isWhitespace(b)) {
                     blanks.append(b);
                 } else {
-                    index = transfer((int) b & 0xFF, buffer, index, to, true);
+                    index = transfer(b & 0xFF, buffer, index, to, true);
                 }
             }
         }
-        return to - from;
+        return to - off;
     }
 
     /**

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStream.java Sun Mar 17 10:36:33 2013
@@ -58,7 +58,7 @@ public class QuotedPrintableOutputStream
 
     private boolean closed = false;
 
-    private byte[] singleByte = new byte[1];
+    private final byte[] singleByte = new byte[1];
 
     public QuotedPrintableOutputStream(int bufsize, OutputStream out, boolean binary) {
         super(out);

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java Sun Mar 17 10:36:33 2013
@@ -137,7 +137,7 @@ public class BufferedLineReaderInputStre
     @Override
     public int read() throws IOException {
         if (!readAllowed()) return -1;
-        int noRead = 0;
+        int noRead;
         while (!hasBufferedData()) {
             noRead = fillBuffer();
             if (noRead == -1) {
@@ -153,7 +153,7 @@ public class BufferedLineReaderInputStre
         if (b == null) {
             return 0;
         }
-        int noRead = 0;
+        int noRead;
         while (!hasBufferedData()) {
             noRead = fillBuffer();
             if (noRead == -1) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java Sun Mar 17 10:36:33 2013
@@ -120,11 +120,7 @@ public class LineReaderInputStreamAdapto
 
     @Override
     public boolean unread(ByteArrayBuffer buf) {
-        if (bis != null) {
-            return bis.unread(buf);
-        } else {
-            return false;
-        }
+        return bis != null && bis.unread(buf);
     }
 
     @Override

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java Sun Mar 17 10:36:33 2013
@@ -43,7 +43,7 @@ public class MimeBoundaryInputStream ext
     private boolean lastPart;
     private boolean completed;
 
-    private BufferedLineReaderInputStream buffer;
+    private final BufferedLineReaderInputStream buffer;
 
     /**
      * Store the first buffer length.

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java Sun Mar 17 10:36:33 2013
@@ -63,8 +63,6 @@ class FallbackBodyDescriptorBuilder impl
     /**
      * Creates a new <code>BodyDescriptor</code> instance.
      *
-     * @param parent the descriptor of the parent or <code>null</code> if this
-     *        is the root descriptor.
      */
     public FallbackBodyDescriptorBuilder(final String parentMimeType, final DecodeMonitor monitor) {
         super();

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java Sun Mar 17 10:36:33 2013
@@ -416,8 +416,7 @@ class MimeEntity implements EntityStateM
 
     private EntityStateMachine nextMimeEntity(EntityState startState, EntityState endState, InputStream instream) {
         if (recursionMode == RecursionMode.M_RAW) {
-            RawEntity message = new RawEntity(instream);
-            return message;
+            return new RawEntity(instream);
         } else {
             MimeEntity mimeentity = new MimeEntity(
                     lineSource,
@@ -514,7 +513,7 @@ class MimeEntity implements EntityStateM
      * @param state
      * @return rendered as string, not null
      */
-    public static final String stateToString(EntityState state) {
+    public static String stateToString(EntityState state) {
         final String result;
         switch (state) {
             case T_END_OF_STREAM:

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java Sun Mar 17 10:36:33 2013
@@ -383,7 +383,7 @@ public class MimeTokenStream {
      * @param state
      * @return rendered as string, not null
      */
-    public static final String stateToString(EntityState state) {
+    public static String stateToString(EntityState state) {
         return MimeEntity.stateToString(state);
     }
 

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawFieldParser.java Sun Mar 17 10:36:33 2013
@@ -38,8 +38,8 @@ public class RawFieldParser {
 
     public static BitSet INIT_BITSET(int ... b) {
         BitSet bitset = new BitSet(b.length);
-        for (int i = 0; i < b.length; i++) {
-            bitset.set(b[i]);
+        for (int aB : b) {
+            bitset.set(aB);
         }
         return bitset;
     }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/ExampleMail.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/ExampleMail.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/ExampleMail.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/ExampleMail.java Sun Mar 17 10:36:33 2013
@@ -652,24 +652,24 @@ public class ExampleMail {
     public static final byte[] MAIL_WITH_RFC822_PART_BYTES = ascii(MAIL_WITH_RFC822_PART);
     public static final byte[] MIME_MULTIPART_EMBEDDED_MESSAGES_BYTES = ascii(MIME_MULTIPART_EMBEDDED_MESSAGES);
 
-    public static final byte[] ascii(String text) {
+    public static byte[] ascii(String text) {
 
         return US_ASCII.encode(text).array();
     }
 
-    public static final byte[] latin1(String text) {
+    public static byte[] latin1(String text) {
 
         return LATIN1.encode(text).array();
     }
 
-    public static final byte[] join(byte[] one, byte[] two) {
+    public static byte[] join(byte[] one, byte[] two) {
         byte[] results = new byte[one.length + two.length];
         System.arraycopy(one, 0, results, 0, one.length);
         System.arraycopy(two, 0, results, one.length, two.length);
         return results;
     }
 
-    public static final byte[] join(byte[][] byteArrays) {
+    public static byte[] join(byte[][] byteArrays) {
         int length = 0;
         for (byte[] bytes : byteArrays) {
             length += bytes.length;
@@ -699,7 +699,6 @@ public class ExampleMail {
             buffer.insert(count, '=');
             count += 79;
         }
-        final String result = buffer.toString();
-        return result;
+        return buffer.toString();
     }
 }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64InputStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64InputStreamTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64InputStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64InputStreamTest.java Sun Mar 17 10:36:33 2013
@@ -35,9 +35,9 @@ public class Base64InputStreamTest {
 
     @Test
     public void testDecode() throws IOException {
-        ByteArrayInputStream bis = null;
-        Base64InputStream decoder = null;
-        byte[] bytes = null;
+        ByteArrayInputStream bis;
+        Base64InputStream decoder;
+        byte[] bytes;
 
         /*
          * Simple initial test.
@@ -130,8 +130,8 @@ public class Base64InputStreamTest {
 
     @Test
     public void testDecodePrematureClose() throws IOException {
-        ByteArrayInputStream bis = null;
-        Base64InputStream decoder = null;
+        ByteArrayInputStream bis;
+        Base64InputStream decoder;
 
         bis = new ByteArrayInputStream(
                 fromString("VGhpcyBpcyB0aGUgcGxhaW4gdGV4dCBtZXNzYWdlIQ=="));

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64OutputStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64OutputStreamTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64OutputStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/Base64OutputStreamTest.java Sun Mar 17 10:36:33 2013
@@ -32,8 +32,8 @@ public class Base64OutputStreamTest {
 
     @Test
     public void testEncode() throws IOException {
-        ByteArrayOutputStream bos = null;
-        Base64OutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        Base64OutputStream encoder;
 
         /*
          * Simple initial test.
@@ -47,8 +47,8 @@ public class Base64OutputStreamTest {
 
     @Test
     public void testEncodeUnderlyingStreamStaysOpen() throws IOException {
-        ByteArrayOutputStream bos = null;
-        Base64OutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        Base64OutputStream encoder;
 
         bos = new ByteArrayOutputStream();
         encoder = new Base64OutputStream(bos);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/CodecUtilTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/CodecUtilTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/CodecUtilTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/CodecUtilTest.java Sun Mar 17 10:36:33 2013
@@ -21,6 +21,7 @@ package org.apache.james.mime4j.codec;
 
 import org.apache.james.mime4j.ExampleMail;
 import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
@@ -85,8 +86,7 @@ public class CodecUtilTest {
         InputStream is = new Base64InputStream(new ByteArrayInputStream(out2.toByteArray()));
         ByteArrayOutputStream outRoundtrip = new ByteArrayOutputStream();
         CodecUtil.copy(is, outRoundtrip);
-        String output = new String(outRoundtrip.toByteArray());
-        return output;
+        return new String(outRoundtrip.toByteArray());
     }
 
     /**
@@ -110,8 +110,7 @@ public class CodecUtilTest {
         InputStream is = new Base64InputStream(new ByteArrayInputStream(out.toByteArray()));
         ByteArrayOutputStream outRoundtrip = new ByteArrayOutputStream();
         CodecUtil.copy(is, outRoundtrip);
-        String output = new String(outRoundtrip.toByteArray());
-        return output;
+        return new String(outRoundtrip.toByteArray());
     }
 
     /* performance test, not a unit test */
@@ -146,13 +145,4 @@ public class CodecUtilTest {
         System.out.println("Stream 1st: "+totalStream1);
     }
     */
-
-    private void assertEquals(byte[] expected, byte[] actual) {
-        StringBuilder buffer = new StringBuilder(expected.length);
-        Assert.assertEquals(expected.length, actual.length);
-        for (int i = 0; i < actual.length; i++) {
-            buffer.append((char) actual[i]);
-            Assert.assertEquals("Mismatch@" + i, expected[i], actual[i]);
-        }
-    }
 }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableInputStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableInputStreamTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableInputStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableInputStreamTest.java Sun Mar 17 10:36:33 2013
@@ -167,8 +167,8 @@ public class QuotedPrintableInputStreamT
 
     @Test
     public void testDecodePrematureClose() throws IOException, UnsupportedEncodingException {
-        ByteArrayInputStream bis = null;
-        QuotedPrintableInputStream decoder = null;
+        ByteArrayInputStream bis;
+        QuotedPrintableInputStream decoder;
 
         bis = new ByteArrayInputStream("=e1=e2=E3=E4\r\n".getBytes("US-ASCII"));
         decoder = new QuotedPrintableInputStream(bis);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStreamTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/QuotedPrintableOutputStreamTest.java Sun Mar 17 10:36:33 2013
@@ -31,8 +31,8 @@ public class QuotedPrintableOutputStream
 
     @Test
     public void testEncode() throws IOException {
-        ByteArrayOutputStream bos = null;
-        QuotedPrintableOutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        QuotedPrintableOutputStream encoder;
 
         /*
          * Simple initial test.
@@ -47,8 +47,8 @@ public class QuotedPrintableOutputStream
 
     @Test
     public void testEncodeUnderlyingStreamStaysOpen() throws IOException {
-        ByteArrayOutputStream bos = null;
-        QuotedPrintableOutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        QuotedPrintableOutputStream encoder;
 
         bos = new ByteArrayOutputStream();
         encoder = new QuotedPrintableOutputStream(bos, false);
@@ -71,8 +71,8 @@ public class QuotedPrintableOutputStream
 
     @Test
     public void testEncodeSpecials() throws IOException {
-        ByteArrayOutputStream bos = null;
-        QuotedPrintableOutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        QuotedPrintableOutputStream encoder;
 
         bos = new ByteArrayOutputStream();
         encoder = new QuotedPrintableOutputStream(bos, false);
@@ -84,8 +84,8 @@ public class QuotedPrintableOutputStream
 
     @Test
     public void testEncodeWrapping() throws IOException {
-        ByteArrayOutputStream bos = null;
-        QuotedPrintableOutputStream encoder = null;
+        ByteArrayOutputStream bos;
+        QuotedPrintableOutputStream encoder;
 
         bos = new ByteArrayOutputStream();
         encoder = new QuotedPrintableOutputStream(bos, false);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java Sun Mar 17 10:36:33 2013
@@ -161,7 +161,7 @@ public class MimeBoundaryInputStreamTest
 
     private String readByOneByte(InputStream is) throws IOException {
         StringBuilder sb = new StringBuilder();
-        int b = 0;
+        int b;
         while ((b = is.read()) != -1) {
             sb.append((char) b);
         }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java Sun Mar 17 10:36:33 2013
@@ -44,7 +44,7 @@ import java.util.jar.JarFile;
  */
 public class MimeStreamParserExampleMessagesTest extends TestCase {
 
-    private URL url;
+    private final URL url;
 
     public MimeStreamParserExampleMessagesTest(String name, URL url) {
         super(name);
@@ -53,8 +53,8 @@ public class MimeStreamParserExampleMess
 
     @Override
     protected void runTest() throws Throwable {
-        MimeStreamParser parser = null;
-        TestHandler handler = null;
+        MimeStreamParser parser;
+        TestHandler handler;
         MimeConfig config = new MimeConfig();
         if (getName().startsWith("malformedHeaderStartsBody")) {
             config.setMalformedHeaderStartsBody(true);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java Sun Mar 17 10:36:33 2013
@@ -85,9 +85,9 @@ public class MimeStreamParserTest {
         StringBuilder sb = new StringBuilder();
         final LinkedList<String> expected = new LinkedList<String>();
         expected.add("From: foo@abr.com");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A subject");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
 
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
@@ -112,7 +112,7 @@ public class MimeStreamParserTest {
         final LinkedList<String> expected = new LinkedList<String>();
         expected.add("The-field: This field\r\rcontains CR:s\r\r"
                 + "not\r\n\tfollowed by LF");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
 
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
@@ -135,9 +135,9 @@ public class MimeStreamParserTest {
                 + "\tfrom mail.cs.tu-berlin.de with smtp\r\n"
                 + "\tid &lt;m0uWPrO-0004wpC&gt;;"
                 + " Wed, 19 Jun 96 18:12 MES");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A folded subject\r\n Line 2\r\n\tLine 3");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
 
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
@@ -197,9 +197,9 @@ public class MimeStreamParserTest {
         final LinkedList<String> expected = new LinkedList<String>();
         sb.append("From - foo@abr.com\r\n");
         expected.add("From: some@one.com");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A subject");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         sb.append("A line which should be ignored\r\n");
 
         MimeStreamParser parser = new MimeStreamParser();
@@ -325,9 +325,9 @@ public class MimeStreamParserTest {
         StringBuilder sb = new StringBuilder();
         final LinkedList<String> expected = new LinkedList<String>();
         expected.add("From: some@one.com");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A subject");
-        sb.append(expected.getLast() + "\r\n\r\n");
+        sb.append(expected.getLast()).append("\r\n\r\n");
 
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
@@ -355,7 +355,7 @@ public class MimeStreamParserTest {
         StringBuilder sb = new StringBuilder();
         final LinkedList<String> expected = new LinkedList<String>();
         expected.add("From: some@one.com");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A subject");
         sb.append(expected.getLast());
 
@@ -374,9 +374,9 @@ public class MimeStreamParserTest {
         sb = new StringBuilder();
         expected.clear();
         expected.add("From: some@one.com");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
         expected.add("Subject: A subject");
-        sb.append(expected.getLast() + "\r\n");
+        sb.append(expected.getLast()).append("\r\n");
 
         parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java Sun Mar 17 10:36:33 2013
@@ -31,7 +31,7 @@ import org.apache.james.mime4j.util.Cont
  * Helper class to run comparison of parsed results
  */
 class TestHandler implements ContentHandler {
-    StringBuilder sb = new StringBuilder();
+    final StringBuilder sb = new StringBuilder();
 
     private String escape(char c) {
         if (c == '&') {
@@ -55,7 +55,7 @@ class TestHandler implements ContentHand
 
     public void epilogue(InputStream is) throws IOException {
         sb.append("<epilogue>\r\n");
-        int b = 0;
+        int b;
         while ((b = is.read()) != -1) {
             sb.append(escape((char) b));
         }
@@ -63,7 +63,7 @@ class TestHandler implements ContentHand
     }
     public void preamble(InputStream is) throws IOException {
         sb.append("<preamble>\r\n");
-        int b = 0;
+        int b;
         while ((b = is.read()) != -1) {
             sb.append(escape((char) b));
         }
@@ -74,7 +74,7 @@ class TestHandler implements ContentHand
     }
     public void body(BodyDescriptor bd, InputStream is) throws IOException {
         sb.append("<body>\r\n");
-        int b = 0;
+        int b;
         while ((b = is.read()) != -1) {
             sb.append(escape((char) b));
         }
@@ -93,9 +93,7 @@ class TestHandler implements ContentHand
         sb.append("<header>\r\n");
     }
     public void field(Field field) {
-        sb.append("<field>\r\n"
-                + escape(ContentUtil.decode(field.getRaw()))
-                + "</field>\r\n");
+        sb.append("<field>\r\n").append(escape(ContentUtil.decode(field.getRaw()))).append("</field>\r\n");
     }
     public void endHeader() {
         sb.append("</header>\r\n");

Modified: james/mime4j/trunk/dom/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/pom.xml (original)
+++ james/mime4j/trunk/dom/pom.xml Sun Mar 17 10:36:33 2013
@@ -17,7 +17,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -28,16 +29,15 @@
     </parent>
 
     <artifactId>apache-mime4j-dom</artifactId>
+    <packaging>bundle</packaging>
 
-    <name>Apache JAMES Mime4j (DOM)</name>
+    <name>Apache James :: Mime4j :: DOM</name>
     <description>Java MIME Document Object Model</description>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-core</artifactId>
-            <version>${project.version}</version>
-            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
@@ -49,16 +49,11 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <type>jar</type>
-            <!-- Removed as a workaround for an unidentified M2 bug -->
-            <scope>test</scope>
-            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
             <scope>test</scope>
-            <optional>true</optional>
         </dependency>
     </dependencies>
 

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/datetime/DateTime.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/datetime/DateTime.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/datetime/DateTime.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/dom/datetime/DateTime.java Sun Mar 17 10:36:33 2013
@@ -156,9 +156,7 @@ public class DateTime {
             return false;
         if (timeZone != other.timeZone)
             return false;
-        if (year != other.year)
-            return false;
-        return true;
+        return year == other.year;
     }
 
 

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java Sun Mar 17 10:36:33 2013
@@ -44,7 +44,7 @@ public class ContentDispositionFieldImpl
     private boolean parsed = false;
 
     private String dispositionType = "";
-    private Map<String, String> parameters = new HashMap<String, String>();
+    private final Map<String, String> parameters = new HashMap<String, String>();
     private ParseException parseException;
 
     private boolean creationDateParsed;

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldLenientImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldLenientImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldLenientImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldLenientImpl.java Sun Mar 17 10:36:33 2013
@@ -52,7 +52,7 @@ public class ContentDispositionFieldLeni
     private boolean parsed = false;
 
     private String dispositionType = "";
-    private Map<String, String> parameters = new HashMap<String, String>();
+    private final Map<String, String> parameters = new HashMap<String, String>();
 
     private boolean creationDateParsed;
     private Date creationDate;

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java Sun Mar 17 10:36:33 2013
@@ -46,7 +46,7 @@ public class ContentLanguageFieldImpl ex
 
     private void parse() {
         parsed = true;
-        languages = Collections.<String>emptyList();
+        languages = Collections.emptyList();
         String body = getBody();
         if (body != null) {
             ContentLanguageParser parser = new ContentLanguageParser(new StringReader(body));

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java Sun Mar 17 10:36:33 2013
@@ -42,7 +42,7 @@ public class ContentTypeFieldImpl extend
     private String mimeType = null;
     private String mediaType = null;
     private String subType = null;
-    private Map<String, String> parameters = new HashMap<String, String>();
+    private final Map<String, String> parameters = new HashMap<String, String>();
     private ParseException parseException;
 
     ContentTypeFieldImpl(Field rawField, DecodeMonitor monitor) {

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldLenientImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldLenientImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldLenientImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldLenientImpl.java Sun Mar 17 10:36:33 2013
@@ -43,7 +43,7 @@ public class ContentTypeFieldLenientImpl
     private String mimeType = null;
     private String mediaType = null;
     private String subType = null;
-    private Map<String, String> parameters = new HashMap<String, String>();
+    private final Map<String, String> parameters = new HashMap<String, String>();
 
     ContentTypeFieldLenientImpl(final Field rawField, final DecodeMonitor monitor) {
         super(rawField, monitor);

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldLenientImpl.java Sun Mar 17 10:36:33 2013
@@ -28,6 +28,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Locale;
@@ -55,9 +56,7 @@ public class DateTimeFieldLenientImpl ex
         if (dateParsers != null) {
             this.datePatterns.addAll(dateParsers);
         } else {
-            for (String pattern : DEFAULT_DATE_FORMATS) {
-                this.datePatterns.add(pattern);
-            }
+            Collections.addAll(this.datePatterns, DEFAULT_DATE_FORMATS);
         }
     }
 

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java Sun Mar 17 10:36:33 2013
@@ -608,10 +608,8 @@ public class Fields {
     }
 
     private static boolean isValidDispositionType(String dispositionType) {
-        if (dispositionType == null)
-            return false;
+        return dispositionType != null && EncoderUtil.isToken(dispositionType);
 
-        return EncoderUtil.isToken(dispositionType);
     }
 
     private static <F extends ParsedField> F parse(FieldParser<F> parser,

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java Sun Mar 17 10:36:33 2013
@@ -38,7 +38,7 @@ import org.apache.james.mime4j.dom.addre
  */
 class Builder {
 
-    private static Builder singleton = new Builder();
+    private static final Builder singleton = new Builder();
 
     public static Builder getInstance() {
         return singleton;
@@ -203,9 +203,9 @@ class Builder {
 
     private static class ChildNodeIterator implements Iterator<Node> {
 
-        private SimpleNode simpleNode;
+        private final SimpleNode simpleNode;
         private int index;
-        private int len;
+        private final int len;
 
         public ChildNodeIterator(SimpleNode simpleNode) {
             this.simpleNode = simpleNode;

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressBuilder.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressBuilder.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressBuilder.java Sun Mar 17 10:36:33 2013
@@ -116,7 +116,6 @@ public class LenientAddressBuilder {
             current = (char) (buf.byteAt(pos) & 0xff);
             if (current == COMMA) {
                 cursor.updatePos(pos + 1);
-                continue;
             } else if (current == COLON) {
                 cursor.updatePos(pos + 1);
                 break;
@@ -209,9 +208,8 @@ public class LenientAddressBuilder {
         } else if (current == AT) {
             // localPart @ domain form
             cursor.updatePos(pos + 1);
-            String localPart = openingText;
             String domain = parseDomain(buf, cursor, delimiters);
-            return new Mailbox(null, null, localPart, domain);
+            return new Mailbox(null, null, openingText, domain);
         } else {
             return createMailbox(openingText);
         }
@@ -285,13 +283,11 @@ public class LenientAddressBuilder {
         } else if (current == AT) {
             // localPart @ domain form
             cursor.updatePos(pos + 1);
-            String localPart = openingText;
             String domain = parseDomain(buf, cursor, delimiters);
-            return new Mailbox(null, null, localPart, domain);
+            return new Mailbox(null, null, openingText, domain);
         } else if (current == COLON) {
             // group-name: localPart @ domain, name <localPart @ domain>; form
             cursor.updatePos(pos + 1);
-            String name = openingText;
             List<Mailbox> mboxes = parseMailboxes(buf, cursor, SEMICOLON_ONLY);
             if (!cursor.atEnd()) {
                 pos = cursor.getPos();
@@ -300,7 +296,7 @@ public class LenientAddressBuilder {
                     cursor.updatePos(pos + 1);
                 }
             }
-            return new Group(name, mboxes);
+            return new Group(openingText, mboxes);
         } else {
             return createMailbox(openingText);
         }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractEntity.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractEntity.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractEntity.java Sun Mar 17 10:36:33 2013
@@ -528,9 +528,7 @@ public abstract class AbstractEntity imp
         if (header == null)
             return null;
 
-        @SuppressWarnings("unchecked")
-        F field = (F) header.getField(fieldName);
-        return field;
+        return (F) header.getField(fieldName);
     }
 
     protected abstract String newUniqueBoundary();

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractHeader.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractHeader.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractHeader.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/AbstractHeader.java Sun Mar 17 10:36:33 2013
@@ -34,8 +34,8 @@ import org.apache.james.mime4j.stream.Fi
  */
 public abstract class AbstractHeader implements Header {
 
-    private List<Field> fields = new LinkedList<Field>();
-    private Map<String, List<Field>> fieldMap = new HashMap<String, List<Field>>();
+    private final List<Field> fields = new LinkedList<Field>();
+    private final Map<String, List<Field>> fieldMap = new HashMap<String, List<Field>>();
 
     /**
      * Creates a new empty <code>Header</code>.

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java Sun Mar 17 10:36:33 2013
@@ -92,7 +92,6 @@ class EntityBuilder implements ContentHa
     }
 
     /**
-     * @see org.apache.james.mime4j.parser.ContentHandler#field(RawField)
      */
     public void field(Field field) throws MimeException {
         expect(Header.class);

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageServiceFactoryImpl.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageServiceFactoryImpl.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageServiceFactoryImpl.java Sun Mar 17 10:36:33 2013
@@ -46,8 +46,8 @@ public class MessageServiceFactoryImpl e
         if (bodyFactory != null) m.setBodyFactory(bodyFactory);
         if (mimeEntityConfig != null) m.setMimeEntityConfig(mimeEntityConfig);
         if (bodyDescriptorBuilder != null) m.setBodyDescriptorBuilder(bodyDescriptorBuilder);
-        if (flatMode != null) m.setFlatMode(flatMode.booleanValue());
-        if (contentDecoding != null) m.setContentDecoding(contentDecoding.booleanValue());
+        if (flatMode != null) m.setFlatMode(flatMode);
+        if (contentDecoding != null) m.setContentDecoding(contentDecoding);
         if (decodeMonitor != null) m.setDecodeMonitor(decodeMonitor);
         return m;
     }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java Sun Mar 17 10:36:33 2013
@@ -46,7 +46,7 @@ import java.util.jar.JarFile;
  */
 public class ExampleMessagesRoundtripTest extends TestCase {
 
-    private URL url;
+    private final URL url;
 
     public ExampleMessagesRoundtripTest(String name, URL url) {
         super(name);

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java Sun Mar 17 10:36:33 2013
@@ -47,7 +47,6 @@ public class MessageCompleteMailTest {
     private Message createMessage(byte[] octets) throws Exception {
         ByteArrayInputStream in = new ByteArrayInputStream(octets);
         DefaultMessageBuilder builder = new DefaultMessageBuilder();
-        Message message = builder.parseMessage(in);
-        return message;
+        return builder.parseMessage(in);
     }
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java Sun Mar 17 10:36:33 2013
@@ -45,7 +45,7 @@ import java.util.jar.JarFile;
 
 public class MessageParserTest extends TestCase {
 
-    private URL url;
+    private final URL url;
 
     public MessageParserTest(String name, URL url) {
         super(name);
@@ -139,9 +139,7 @@ public class MessageParserTest extends T
 
         sb.append("<header>\r\n");
         for (Field field : e.getHeader().getFields()) {
-            sb.append("<field>\r\n"
-                    + escape(FieldsTest.decode(field))
-                    + "</field>\r\n");
+            sb.append("<field>\r\n").append(escape(FieldsTest.decode(field))).append("</field>\r\n");
         }
         sb.append("</header>\r\n");
 
@@ -178,7 +176,7 @@ public class MessageParserTest extends T
                     + (b instanceof TextBody ? ".txt" : ".bin");
             String tag = b instanceof TextBody ? "text-body" : "binary-body";
             File f = new File(s);
-            sb.append("<" + tag + " name=\"" + f.getName() + "\"/>\r\n");
+            sb.append("<").append(tag).append(" name=\"").append(f.getName()).append("\"/>\r\n");
             URL expectedUrl = new URL(s);
 
             if (b instanceof TextBody) {

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java Sun Mar 17 10:36:33 2013
@@ -74,8 +74,8 @@ public class MessageTest {
 
     @Test
     public void testGetMimeType() {
-        MessageImpl parent = null;
-        MessageImpl child = null;
+        MessageImpl parent;
+        MessageImpl child;
 
         parent = new MessageImpl();
         child = new MessageImpl();
@@ -146,7 +146,7 @@ public class MessageTest {
 
         InputStream output = new ByteArrayInputStream(out.toByteArray());
 
-        int b = -1;
+        int b;
         int i = 0;
         while ((b = output.read()) != -1) {
             Assert.assertEquals("same byte", b, inputByte[i]);

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java Sun Mar 17 10:36:33 2013
@@ -22,9 +22,7 @@ package org.apache.james.mime4j.dom;
 import org.apache.james.mime4j.ExampleMail;
 import org.apache.james.mime4j.message.DefaultMessageBuilder;
 import org.apache.james.mime4j.message.DefaultMessageWriter;
-import org.junit.After;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
@@ -85,7 +83,6 @@ public class MessageWriteToTest {
     private Message createMessage(byte[] octets) throws Exception {
         ByteArrayInputStream in = new ByteArrayInputStream(octets);
         DefaultMessageBuilder builder = new DefaultMessageBuilder();
-        Message message = builder.parseMessage(in);
-        return message;
+        return builder.parseMessage(in);
     }
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java Sun Mar 17 10:36:33 2013
@@ -61,7 +61,6 @@ public class ContentTypeFieldTest {
     @Test
     public void testGetMimeTypeStatic() throws Exception {
         ContentTypeField child = parse("Content-Type: child/type");
-        ;
         ContentTypeField parent = parse("Content-Type: parent/type");
 
         Assert.assertEquals("child/type", ContentTypeFieldImpl.getMimeType(child, parent));

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java Sun Mar 17 10:36:33 2013
@@ -27,7 +27,7 @@ public class UnstructuredFieldTest {
 
     @Test
     public void testGetBody() throws Exception {
-        UnstructuredField f = null;
+        UnstructuredField f;
 
         f = (UnstructuredField) DefaultFieldParser.parse("Subject: Yada\r\n yada yada\r\n");
         Assert.assertEquals("Testing folding value 1", "Yada yada yada", f.getValue());

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java Sun Mar 17 10:36:33 2013
@@ -143,7 +143,7 @@ public class AddressTest {
         Assert.assertFalse(m1.equals(m2));
         Assert.assertTrue(m1.equals(m3));
         Assert.assertFalse(m1.equals(m4));
-        Assert.assertFalse(m1.equals(null));
+        Assert.assertFalse(m1 == null);
     }
 
     @Test

Modified: james/mime4j/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/examples/pom.xml (original)
+++ james/mime4j/trunk/examples/pom.xml Sun Mar 17 10:36:33 2013
@@ -29,30 +29,27 @@
     </parent>
 
     <artifactId>apache-mime4j-examples</artifactId>
+    <packaging>bundle</packaging>
 
-    <name>Apache JAMES Mime4j (Code Examples)</name>
+    <name>Apache James :: Mime4j :: Code Examples</name>
     <description>Examples for Mime4J stream based MIME message parser</description>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-dom</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-mbox-iterator</artifactId>
-            <version>0.8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-storage</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
-            <scope>compile</scope>
         </dependency>
     </dependencies>
 </project>

Modified: james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/LoggingMonitor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/LoggingMonitor.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/LoggingMonitor.java (original)
+++ james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/LoggingMonitor.java Sun Mar 17 10:36:33 2013
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.james.mime4j.codec.DecodeMonitor;
 
 public final class LoggingMonitor extends DecodeMonitor {
-    private static Log log = LogFactory.getLog(LoggingMonitor.class);
+    private static final Log log = LogFactory.getLog(LoggingMonitor.class);
 
     public static DecodeMonitor MONITOR = new LoggingMonitor();
 

Modified: james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java (original)
+++ james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java Sun Mar 17 10:36:33 2013
@@ -71,9 +71,8 @@ import org.apache.james.mime4j.stream.Fi
 public class MessageTree extends JPanel implements TreeSelectionListener {
     private static final long serialVersionUID = 1L;
 
-    private JPanel contentPane;
-    private JTextArea textView;
-    private JTree tree;
+    private final JTextArea textView;
+    private final JTree tree;
 
     /**
      * Wraps an Object and associates it with a text. All message parts
@@ -118,7 +117,7 @@ public class MessageTree extends JPanel 
 
         JScrollPane treeView = new JScrollPane(tree);
 
-        contentPane = new JPanel(new GridLayout(1,0));
+        JPanel contentPane = new JPanel(new GridLayout(1, 0));
         JScrollPane contentView = new JScrollPane(contentPane);
 
         JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
@@ -143,7 +142,6 @@ public class MessageTree extends JPanel 
      * Create a node given a Multipart body.
      * Add the Preamble, all Body parts and the Epilogue to the node.
      *
-     * @param multipart the Multipart.
      * @return the root node of the tree.
      */
     private DefaultMutableTreeNode createNode(Header header) {
@@ -301,9 +299,9 @@ public class MessageTree extends JPanel 
                  */
                 ContentTypeField field = (ContentTypeField) o;
                 StringBuilder sb = new StringBuilder();
-                sb.append("MIME type: " + field.getMimeType() + "\n");
+                sb.append("MIME type: ").append(field.getMimeType()).append("\n");
                 for (Map.Entry<String, String> entry : field.getParameters().entrySet()) {
-                    sb.append(entry.getKey() + " = " + entry.getValue() + "\n");
+                    sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                 }
                 textView.setText(sb.toString());
 
@@ -314,9 +312,9 @@ public class MessageTree extends JPanel 
                 AddressListField field = (AddressListField) o;
                 MailboxList list = field.getAddressList().flatten();
                 StringBuilder sb = new StringBuilder();
-                for (int i = 0; i < list.size(); i++) {
-                    Mailbox mb = list.get(i);
-                    sb.append(AddressFormatter.DEFAULT.format(mb, false) + "\n");
+                for (Object aList : list) {
+                    Mailbox mb = aList;
+                    sb.append(AddressFormatter.DEFAULT.format(mb, false)).append("\n");
                 }
                 textView.setText(sb.toString());
 

Modified: james/mime4j/trunk/mbox/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/mbox/pom.xml?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/mbox/pom.xml (original)
+++ james/mime4j/trunk/mbox/pom.xml Sun Mar 17 10:36:33 2013
@@ -29,20 +29,15 @@
     </parent>
 
     <artifactId>apache-mime4j-mbox-iterator</artifactId>
-    <packaging>jar</packaging>
+    <packaging>bundle</packaging>
 
-    <name>Apache JAMES Mime4j (Mbox Iterator)</name>
+    <name>Apache James :: Mime4j :: Mbox Iterator</name>
     <description>Provides a fast iterator like interface for Mbox files using NIO.</description>
 
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>test</scope>
         </dependency>
     </dependencies>
 

Modified: james/mime4j/trunk/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/CharBufferWrapper.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/CharBufferWrapper.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/CharBufferWrapper.java (original)
+++ james/mime4j/trunk/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/CharBufferWrapper.java Sun Mar 17 10:36:33 2013
@@ -52,13 +52,20 @@ public class CharBufferWrapper {
     }
 
     @Override
-    public int hashCode() {
-        return messageBuffer.hashCode();
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof CharBufferWrapper)) return false;
+
+        CharBufferWrapper that = (CharBufferWrapper) o;
+
+        if (!messageBuffer.equals(that.messageBuffer)) return false;
+
+        return true;
     }
 
     @Override
-    public boolean equals(Object obj) {
-        return messageBuffer.equals(obj);
+    public int hashCode() {
+        return messageBuffer.hashCode();
     }
 
     /**

Modified: james/mime4j/trunk/mbox/src/test/java/org/apache/james/mime4j/mboxiterator/MboxIteratorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/mbox/src/test/java/org/apache/james/mime4j/mboxiterator/MboxIteratorTest.java?rev=1457421&r1=1457420&r2=1457421&view=diff
==============================================================================
--- james/mime4j/trunk/mbox/src/test/java/org/apache/james/mime4j/mboxiterator/MboxIteratorTest.java (original)
+++ james/mime4j/trunk/mbox/src/test/java/org/apache/james/mime4j/mboxiterator/MboxIteratorTest.java Sun Mar 17 10:36:33 2013
@@ -33,7 +33,7 @@ public class MboxIteratorTest {
     @Rule
     public final TestName name = new TestName();
     public static final String MBOX_PATH = "src/test/resources/test-1/mbox.rlug";
-    private int DEFAULT_MESSAGE_SIZE = 10 * 1024;
+    private final int DEFAULT_MESSAGE_SIZE = 10 * 1024;
     // number of chars oin our largest test message
     private static final int CHARS_IN_MAX_MSG = 3500;
     private static final int MORE_THAN_FILE_SIZE = 13291;



Mime
View raw message