james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r718018 [1/3] - in /james/mime4j/trunk: ./ examples/src/java/org/apache/james/mime4j/samples/tree/ src/main/java/org/apache/james/mime4j/decoder/ src/main/java/org/apache/james/mime4j/descriptor/ src/main/java/org/apache/james/mime4j/field/...
Date Sun, 16 Nov 2008 12:56:22 GMT
Author: olegk
Date: Sun Nov 16 04:56:20 2008
New Revision: 718018

URL: http://svn.apache.org/viewvc?rev=718018&view=rev
Log:
MIME4J-85: Upgrade source to Java 5

Contributed by Markus Wiederkehr <markus.wiederkehr at gmail.com> 

Added:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Mode.java
Modified:
    james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
    james/mime4j/trunk/pom.xml
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64InputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64OutputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/ByteQueue.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/UnboundedFifoByteBuffer.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/ContentDescriptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC2183ContentDispositionDescriptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC3066ContentLanguageDescriptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Field.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Address.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Builder.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Group.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/NamedMailbox.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/datetime/DateTime.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/EOLConvertingInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LimitedInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/PositionInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/RootInputStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Body.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Multipart.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileBinaryBody.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileTextBody.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/storage/SimpleTempStorage.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/Event.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntity.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntityConfig.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/ByteArrayBuffer.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/CharArrayBuffer.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/CharsetUtil.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MessageUtils.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/ExampleMail.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/Base64InputStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/CodecUtilTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/DecoderUtilTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/QuotedPrintableEncodeTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/decoder/QuotedPrintableTextEncodeTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptorTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptorTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/mimeversion/MimeVersionParserTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/structured/StructuredFieldParserTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/io/BufferedLineReaderInputStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptorTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/io/MimeBoundaryInputStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageCompleteMailTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeStreamTokenMessageRfc822Test.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeTokenEmbeddedMessageTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeTokenNoRecurseTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeTokenStreamBodyDescriptorTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeTokenStreamReaderTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MimeTokenStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MultipartStreamTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/MultipartTokensTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MessageUtilsTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/StringArrayMapTest.java
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/TestByteArrayBuffer.java

Modified: james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java (original)
+++ james/mime4j/trunk/examples/src/java/org/apache/james/mime4j/samples/tree/MessageTree.java Sun Nov 16 04:56:20 2008
@@ -27,7 +27,6 @@
 import java.io.InputStream;
 import java.io.Reader;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.swing.JFrame;
@@ -146,8 +145,7 @@
         DefaultMutableTreeNode node = new DefaultMutableTreeNode(
                 new ObjectWrapper("Header", header));
 
-        for (Iterator it = header.getFields().iterator(); it.hasNext();) {
-            Field field = (Field) it.next();
+        for (Field field : header.getFields()) {
             String name = field.getName();
             
             node.add(new DefaultMutableTreeNode(new ObjectWrapper(name, field)));
@@ -169,8 +167,7 @@
 
         node.add(new DefaultMutableTreeNode(
                        new ObjectWrapper("Preamble", multipart.getPreamble())));
-        for (Iterator it = multipart.getBodyParts().iterator(); it.hasNext();) {
-            BodyPart part = (BodyPart) it.next();
+        for (BodyPart part : multipart.getBodyParts()) {
             node.add(createNode(part));
         }
         node.add(new DefaultMutableTreeNode(
@@ -262,7 +259,7 @@
                  * A text body. Display its contents.
                  */
                 TextBody body = (TextBody) o;
-                StringBuffer sb = new StringBuffer();
+                StringBuilder sb = new StringBuilder();
                 try {
                     Reader r = body.getReader();
                     int c;
@@ -298,11 +295,10 @@
                  * Content-Type field.
                  */
                 ContentTypeField field = (ContentTypeField) o;
-                StringBuffer sb = new StringBuffer();
+                StringBuilder sb = new StringBuilder();
                 sb.append("MIME type: " + field.getMimeType() + "\n");
-                Map params = field.getParameters();
-                for (Iterator it = params.keySet().iterator(); it.hasNext();) {
-                    String name = (String) it.next();
+                Map<String, String> params = field.getParameters();
+                for (String name : params.keySet()) {
                     sb.append(name + " = " + params.get(name) + "\n");
                 }
                 textView.setText(sb.toString());
@@ -313,7 +309,7 @@
                  */
                 AddressListField field = (AddressListField) o;
                 MailboxList list = field.getAddressList().flatten();
-                StringBuffer sb = new StringBuffer();
+                StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < list.size(); i++) {
                     Mailbox mb = list.get(i);
                     sb.append(mb.getAddressString() + "\n");

Modified: james/mime4j/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/pom.xml?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/pom.xml (original)
+++ james/mime4j/trunk/pom.xml Sun Nov 16 04:56:20 2008
@@ -89,8 +89,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.4</source>
-          <target>1.4</target>
+          <source>1.5</source>
+          <target>1.5</target>
           <encoding>iso8859-1</encoding>
         </configuration>
       </plugin>      
@@ -205,6 +205,21 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>retrotranslator-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>translate-project</goal>
+            </goals>
+            <configuration>
+              <classifier>jdk14</classifier>
+              <attach>true</attach>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <repositories>

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64InputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64InputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64InputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64InputStream.java Sun Nov 16 04:56:20 2008
@@ -49,10 +49,12 @@
      * 
      * @throws IOException on I/O errors.
      */
+    @Override
     public void close() throws IOException {
         closed = true;
     }
     
+    @Override
     public int read() throws IOException {
         if (closed) {
             throw new IOException("Base64InputStream has been closed");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64OutputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64OutputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64OutputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/Base64OutputStream.java Sun Nov 16 04:56:20 2008
@@ -254,8 +254,8 @@
      * @return <code>true</code> if any byte is a valid character in the Base64 alphabet; false herwise
      */
     private static boolean containsBase64Byte(byte[] arrayOctet) {
-        for (int i = 0; i < arrayOctet.length; i++) {
-            if (isBase64(arrayOctet[i])) {
+        for (byte octet : arrayOctet) {
+            if (isBase64(octet)) {
                 return true;
             }
         }
@@ -269,6 +269,7 @@
     /**
      * Writes the specified <code>byte</code> to this output stream.
      */
+    @Override
     public void write(int i) throws IOException {
         singleByte[0] = (byte) i;
         write(singleByte, 0, 1);
@@ -288,6 +289,7 @@
      * @throws NullPointerException if the byte array parameter is null
      * @throws IndexOutOfBoundsException if offset, len or buffer size are invalid
      */
+    @Override
     public void write(byte b[], int offset, int len) throws IOException {
         if (closed) {
         	throw new IOException("Base64OutputStream has been closed");
@@ -375,6 +377,7 @@
      *
      * @throws IOException if an I/O error occurs.
      */
+    @Override
     public void flush() throws IOException {
         flushBuffer();
         out.flush();
@@ -384,6 +387,7 @@
      * Terminates the BASE64 coded content and flushes the internal buffers. This method does
      * NOT close the underlying output stream.
      */
+    @Override
     public void close() throws IOException {
         if (closed) {
             return;

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/ByteQueue.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/ByteQueue.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/ByteQueue.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/ByteQueue.java Sun Nov 16 04:56:20 2008
@@ -54,7 +54,7 @@
             buf = new UnboundedFifoByteBuffer();
     }
 
-    public Iterator iterator() {
+    public Iterator<Byte> iterator() {
         return buf.iterator();
     }
 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableInputStream.java Sun Nov 16 04:56:20 2008
@@ -51,10 +51,12 @@
      * 
      * @throws IOException on I/O errors.
      */
+    @Override
     public void close() throws IOException {
         this.closed = true;
     }
 
+    @Override
     public int read() throws IOException {
         if (closed) {
             throw new IOException("QuotedPrintableInputStream has been closed");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.java Sun Nov 16 04:56:20 2008
@@ -38,6 +38,7 @@
         encoder.initEncoding(out);
     }
 
+    @Override
     public void close() throws IOException {
     	if (closed) return;
 
@@ -49,14 +50,17 @@
     	}
     }
 
+    @Override
     public void flush() throws IOException {
         encoder.flushOutput();
     }
 
+    @Override
     public void write(int b) throws IOException {
         this.write(new byte[] { (byte) b }, 0, 1);
     }
 
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         if (closed) {
             throw new IOException("QuotedPrintableOutputStream has been closed");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/UnboundedFifoByteBuffer.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/UnboundedFifoByteBuffer.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/UnboundedFifoByteBuffer.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/UnboundedFifoByteBuffer.java Sun Nov 16 04:56:20 2008
@@ -216,8 +216,8 @@
      *
      * @return an iterator over this buffer's elements
      */
-    public Iterator iterator() {
-        return new Iterator() {
+    public Iterator<Byte> iterator() {
+        return new Iterator<Byte>() {
 
             private int index = head;
             private int lastReturnedIndex = -1;
@@ -227,7 +227,7 @@
 
             }
 
-            public Object next() {
+            public Byte next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/ContentDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/ContentDescriptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/ContentDescriptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/ContentDescriptor.java Sun Nov 16 04:56:20 2008
@@ -78,7 +78,7 @@
     /**
      * Returns the map of parameters of the content-type header.
      */
-    Map getContentTypeParameters();
+    Map<String, String> getContentTypeParameters();
 
     /**
      * Returns the body descriptors content-length.

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java Sun Nov 16 04:56:20 2008
@@ -57,7 +57,7 @@
     private String boundary = null;
     private String charset = US_ASCII;
     private String transferEncoding = "7bit";
-    private Map parameters = new HashMap();
+    private Map<String, String> parameters = new HashMap<String, String>();
     private boolean contentTypeSet;
     private boolean contentTransferEncSet;
     private long contentLength = -1;
@@ -120,9 +120,9 @@
     private void parseContentType(String value) {
         contentTypeSet = true;
         
-        Map params = MimeUtil.getHeaderParams(value);
+        Map<String, String> params = MimeUtil.getHeaderParams(value);
         
-        String main = (String) params.get("");
+        String main = params.get("");
         String type = null;
         String subtype = null;
         if (main != null) {
@@ -144,7 +144,7 @@
                 subtype = null;
             }
         }
-        String b = (String) params.get("boundary");
+        String b = params.get("boundary");
         
         if (main != null 
                 && ((main.startsWith("multipart/") && b != null) 
@@ -159,7 +159,7 @@
             boundary = b;
         }
         
-        String c = (String) params.get("charset");
+        String c = params.get("charset");
         charset = null;
         if (c != null) {
             c = c.trim();
@@ -212,7 +212,7 @@
      * 
      * @return parameters
      */
-    public Map getContentTypeParameters() {
+    public Map<String, String> getContentTypeParameters() {
         return parameters;
     }
     
@@ -225,6 +225,7 @@
         return transferEncoding;
     }
     
+    @Override
     public String toString() {
         return mimeType;
     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java Sun Nov 16 04:56:20 2008
@@ -51,7 +51,7 @@
     private String contentDescription;
     private boolean isContentDescriptionSet;
     private String contentDispositionType;
-    private Map contentDispositionParameters;
+    private Map<String, String> contentDispositionParameters;
     private DateTime contentDispositionModificationDate;
     private MimeException contentDispositionModificationDateParseException;
     private DateTime contentDispositionCreationDate;
@@ -61,7 +61,7 @@
     private long contentDispositionSize;
     private MimeException contentDispositionSizeParseException;
     private boolean isContentDispositionSet;
-    private List contentLanguage;
+    private List<String> contentLanguage;
     private MimeException contentLanguageParseException;
     private boolean isContentLanguageSet;
     private MimeException contentLocationParseException;
@@ -84,7 +84,7 @@
         this.contentDescription = null;
         this.isContentDescriptionSet = false;
         this.contentDispositionType = null;
-        this.contentDispositionParameters = Collections.EMPTY_MAP;
+        this.contentDispositionParameters = Collections.emptyMap();
         this.contentDispositionModificationDate = null;
         this.contentDispositionModificationDateParseException = null;
         this.contentDispositionCreationDate = null;
@@ -104,6 +104,7 @@
         this.isContentMD5Set = false;
     }
     
+    @Override
     public void addField(String name, String value) {
         name = name.trim().toLowerCase();
         if (MimeUtil.MIME_HEADER_MIME_VERSION.equals(name) && !isMimeVersionSet) {
@@ -151,7 +152,9 @@
         if (value != null) {
             try {
                 final ContentLanguageParser parser = new ContentLanguageParser(new StringReader(value));
-                contentLanguage = parser.parse();
+                @SuppressWarnings("unchecked")
+                final List<String> stringList = (List<String>) parser.parse();
+                contentLanguage = stringList;
             } catch (MimeException e) {
                 contentLanguageParseException = e;
             }
@@ -161,10 +164,10 @@
     private void parseContentDisposition(final String value) {
         isContentDispositionSet = true;
         contentDispositionParameters = MimeUtil.getHeaderParams(value);
-        contentDispositionType = (String) contentDispositionParameters.get("");
+        contentDispositionType = contentDispositionParameters.get("");
         
         final String contentDispositionModificationDate 
-            = (String) contentDispositionParameters.get(MimeUtil.PARAM_MODIFICATION_DATE);
+            = contentDispositionParameters.get(MimeUtil.PARAM_MODIFICATION_DATE);
         if (contentDispositionModificationDate != null) {
             try {
                 this.contentDispositionModificationDate = parseDate(contentDispositionModificationDate);
@@ -174,7 +177,7 @@
         }
         
         final String contentDispositionCreationDate 
-            = (String) contentDispositionParameters.get(MimeUtil.PARAM_CREATION_DATE);
+            = contentDispositionParameters.get(MimeUtil.PARAM_CREATION_DATE);
         if (contentDispositionCreationDate != null) {
             try {
                 this.contentDispositionCreationDate = parseDate(contentDispositionCreationDate);
@@ -184,7 +187,7 @@
         }
         
         final String contentDispositionReadDate 
-            = (String) contentDispositionParameters.get(MimeUtil.PARAM_READ_DATE);
+            = contentDispositionParameters.get(MimeUtil.PARAM_READ_DATE);
         if (contentDispositionReadDate != null) {
             try {
                 this.contentDispositionReadDate = parseDate(contentDispositionReadDate);
@@ -193,7 +196,7 @@
             }         
         }
         
-        final String size = (String) contentDispositionParameters.get(MimeUtil.PARAM_SIZE);
+        final String size = contentDispositionParameters.get(MimeUtil.PARAM_SIZE);
         if (size != null) {
             try {
                 contentDispositionSize = Long.parseLong(size);
@@ -293,7 +296,7 @@
     /**
      * @see org.apache.james.mime4j.descriptor.RFC2183ContentDispositionDescriptor#getContentDispositionParameters()
      */
-    public Map getContentDispositionParameters() {
+    public Map<String, String> getContentDispositionParameters() {
         return contentDispositionParameters;
     }
     
@@ -301,7 +304,7 @@
      * @see org.apache.james.mime4j.descriptor.RFC2183ContentDispositionDescriptor#getContentDispositionFilename()
      */
     public String getContentDispositionFilename() {
-        return (String) contentDispositionParameters.get(MimeUtil.PARAM_FILENAME);
+        return contentDispositionParameters.get(MimeUtil.PARAM_FILENAME);
     }
     
     /**
@@ -363,7 +366,7 @@
     /**
      * @see org.apache.james.mime4j.descriptor.RFC3066ContentLanguageDescriptor#getContentLanguage()
      */
-    public List getContentLanguage() {
+    public List<String> getContentLanguage() {
         return contentLanguage;
     }
 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC2183ContentDispositionDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC2183ContentDispositionDescriptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC2183ContentDispositionDescriptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC2183ContentDispositionDescriptor.java Sun Nov 16 04:56:20 2008
@@ -44,7 +44,7 @@
      * @return parameter value strings indexed by parameter name strings,
      * not null
      */
-    public abstract Map getContentDispositionParameters();
+    public abstract Map<String, String> getContentDispositionParameters();
 
     /**
      * Gets the <code>filename</code> parameter value of the <code>content-disposition</code> field.

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC3066ContentLanguageDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC3066ContentLanguageDescriptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC3066ContentLanguageDescriptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/descriptor/RFC3066ContentLanguageDescriptor.java Sun Nov 16 04:56:20 2008
@@ -35,7 +35,7 @@
      * @return list of language tag Strings,
      * or null if no header exists
      */
-    public abstract List getContentLanguage();
+    public abstract List<String> getContentLanguage();
 
     /**
      * Gets any exception thrown during the parsing of {@link #getContentLanguage()}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java Sun Nov 16 04:56:20 2008
@@ -20,9 +20,9 @@
 package org.apache.james.mime4j.field;
 
 import java.io.StringReader;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -64,10 +64,10 @@
     public static final String PARAM_CHARSET = "charset";
     
     private String mimeType = "";
-    private Map parameters = null;
+    private Map<String, String> parameters = null;
     private ParseException parseException;
 
-    protected ContentTypeField(String name, String body, String raw, String mimeType, Map parameters, ParseException parseException) {
+    protected ContentTypeField(String name, String body, String raw, String mimeType, Map<String, String> parameters, ParseException parseException) {
         super(name, body, raw);
         this.mimeType = mimeType;
         this.parameters = parameters;
@@ -127,7 +127,7 @@
      */
     public String getParameter(String name) {
         return parameters != null 
-                    ? (String) parameters.get(name.toLowerCase())
+                    ? parameters.get(name.toLowerCase())
                     : null;
     }
     
@@ -136,10 +136,10 @@
      * 
      * @return the parameters.
      */
-    public Map getParameters() {
+    public Map<String, String> getParameters() {
         return parameters != null 
-                    ? Collections.unmodifiableMap(parameters)
-                    : Collections.EMPTY_MAP;
+                    ? Collections.<String, String> unmodifiableMap(parameters)
+                    : Collections.<String, String> emptyMap();
     }
     
     /**
@@ -205,7 +205,7 @@
         public Field parse(final String name, final String body, final String raw) {
             ParseException parseException = null;
             String mimeType = "";
-            Map parameters = null;
+            Map<String, String> parameters = null;
 
             ContentTypeParser parser = new ContentTypeParser(new StringReader(body));
             try {
@@ -231,15 +231,17 @@
                 if (type != null && subType != null) {
                     mimeType = (type + "/" + parser.getSubType()).toLowerCase();
 
-                    ArrayList paramNames = parser.getParamNames();
-                    ArrayList paramValues = parser.getParamValues();
+                    @SuppressWarnings("unchecked")
+                    List<String> paramNames = parser.getParamNames();
+                    @SuppressWarnings("unchecked")
+                    List<String> paramValues = parser.getParamValues();
 
                     if (paramNames != null && paramValues != null) {
                         for (int i = 0; i < paramNames.size() && i < paramValues.size(); i++) {
                             if (parameters == null)
-                                parameters = new HashMap((int)(paramNames.size() * 1.3 + 1));
-                            String paramName = ((String)paramNames.get(i)).toLowerCase();
-                            String paramValue = ((String)paramValues.get(i));
+                                parameters = new HashMap<String, String>((int)(paramNames.size() * 1.3 + 1));
+                            String paramName = paramNames.get(i).toLowerCase();
+                            String paramValue = paramValues.get(i);
                             parameters.put(paramName, paramValue);
                         }
                     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java Sun Nov 16 04:56:20 2008
@@ -20,7 +20,7 @@
 
 public class DelegatingFieldParser implements FieldParser {
     
-    private Map parsers = new HashMap();
+    private Map<String, FieldParser> parsers = new HashMap<String, FieldParser>();
     private FieldParser defaultParser = new UnstructuredField.Parser();
     
     /**
@@ -33,7 +33,7 @@
     }
     
     public FieldParser getParser(final String name) {
-        final FieldParser field = (FieldParser) parsers.get(name.toLowerCase());
+        final FieldParser field = parsers.get(name.toLowerCase());
         if(field==null) {
             return defaultParser;
         }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Field.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Field.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Field.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/Field.java Sun Nov 16 04:56:20 2008
@@ -188,6 +188,7 @@
     /**
      * @see #getRaw()
      */
+    @Override
     public String toString() {
         return raw;
     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Address.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Address.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Address.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Address.java Sun Nov 16 04:56:20 2008
@@ -19,7 +19,7 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.ArrayList;
+import java.util.List;
 
 /**
  * The abstract base for classes that represent RFC2822 addresses.
@@ -33,20 +33,20 @@
 
 	/**
 	 * Adds any mailboxes represented by this address
-	 * into the given ArrayList. Note that this method
+	 * into the given List. Note that this method
 	 * has default (package) access, so a doAddMailboxesTo
 	 * method is needed to allow the behavior to be
 	 * overridden by subclasses.
 	 */
-	final void addMailboxesTo(ArrayList results) {
+	final void addMailboxesTo(List<Mailbox> results) {
 		doAddMailboxesTo(results);
 	}
 	
 	/**
 	 * Adds any mailboxes represented by this address
-	 * into the given ArrayList. Must be overridden by
+	 * into the given List. Must be overridden by
 	 * concrete subclasses.
 	 */
-	protected abstract void doAddMailboxesTo(ArrayList results);
+	protected abstract void doAddMailboxesTo(List<Mailbox> results);
 
 }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java Sun Nov 16 04:56:20 2008
@@ -24,6 +24,7 @@
 
 import java.io.StringReader;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * An immutable, random-access list of Address objects.
@@ -32,17 +33,17 @@
  */
 public class AddressList {
 	
-	private ArrayList addresses;
+	private List<? extends Address> addresses;
 
 	/**
-	 * @param addresses An ArrayList that contains only Address objects. 
+	 * @param addresses A List that contains only Address objects. 
 	 * @param dontCopy true iff it is not possible for the addresses ArrayList to be modified by someone else.
 	 */
-	public AddressList(ArrayList addresses, boolean dontCopy) {
+	public AddressList(List<? extends Address> addresses, boolean dontCopy) {
 		if (addresses != null)
-			this.addresses = (dontCopy ? addresses : (ArrayList) addresses.clone());
+			this.addresses = dontCopy ? addresses : new ArrayList<Address>(addresses);
 		else
-			this.addresses = new ArrayList(0);
+			this.addresses = new ArrayList<Address>(0);
 	}
 
 	/**
@@ -58,7 +59,7 @@
 	public Address get(int index) {
 		if (0 > index || size() <= index)
 			throw new IndexOutOfBoundsException();
-		return (Address) addresses.get(index);
+		return addresses.get(index);
 	}
 
 	/**
@@ -69,19 +70,21 @@
 	public MailboxList flatten() {
 		// in the common case, all addresses are mailboxes
 		boolean groupDetected = false;
-		for (int i = 0; i < size(); i++) {
-			if (!(get(i) instanceof Mailbox)) {
+		for (Address addr : addresses) {
+			if (!(addr instanceof Mailbox)) {
 				groupDetected = true;
 				break;
 			}
 		}
 		
-		if (!groupDetected)
-			return new MailboxList(addresses, true);
+		if (!groupDetected) {
+			@SuppressWarnings("unchecked")
+			final List<Mailbox> mailboxes = (List<Mailbox>) addresses; 
+			return new MailboxList(mailboxes, true);
+		}
 		
-		ArrayList results = new ArrayList();
-		for (int i = 0; i < size(); i++) {
-			Address addr = get(i);
+		List<Mailbox> results = new ArrayList<Mailbox>();
+		for (Address addr : addresses) {
 			addr.addMailboxesTo(results);
 		}
 		
@@ -95,8 +98,7 @@
 	 * stdout, for debugging purposes.
 	 */
 	public void print() {
-		for (int i = 0; i < size(); i++) {
-			Address addr = get(i);
+		for (Address addr : addresses) {
 			System.out.println(addr.toString());
 		}
 	}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Builder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Builder.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Builder.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Builder.java Sun Nov 16 04:56:20 2008
@@ -37,6 +37,7 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * Transforms the JJTree-generated abstract syntax tree
@@ -55,7 +56,7 @@
 	
 	
 	public AddressList buildAddressList(ASTaddress_list node) {
-		ArrayList list = new ArrayList();
+		List<Address> list = new ArrayList<Address>();
 		for (int i = 0; i < node.jjtGetNumChildren(); i++) {
 			ASTaddress childNode = (ASTaddress) node.jjtGetChild(i);
 			Address address = buildAddress(childNode);
@@ -66,7 +67,7 @@
 
 	private Address buildAddress(ASTaddress node) {
 		ChildNodeIterator it = new ChildNodeIterator(node);
-		Node n = it.nextNode();
+		Node n = it.next();
 		if (n instanceof ASTaddr_spec) {
 			return buildAddrSpec((ASTaddr_spec)n);
 		}
@@ -75,7 +76,7 @@
 		}
 		else if (n instanceof ASTphrase) {
 			String name = buildString((ASTphrase)n, false);
-			Node n2 = it.nextNode();
+			Node n2 = it.next();
 			if (n2 instanceof ASTgroup_body) {
 				return new Group(name, buildGroupBody((ASTgroup_body)n2));
 			}
@@ -95,10 +96,10 @@
 	
 	
 	private MailboxList buildGroupBody(ASTgroup_body node) {
-		ArrayList results = new ArrayList();
+		List<Mailbox> results = new ArrayList<Mailbox>();
 		ChildNodeIterator it = new ChildNodeIterator(node);
 		while (it.hasNext()) {
-			Node n = it.nextNode();
+			Node n = it.next();
 			if (n instanceof ASTmailbox)
 				results.add(buildMailbox((ASTmailbox)n));
 			else
@@ -109,7 +110,7 @@
 
 	private Mailbox buildMailbox(ASTmailbox node) {
 		ChildNodeIterator it = new ChildNodeIterator(node);
-		Node n = it.nextNode();
+		Node n = it.next();
 		if (n instanceof ASTaddr_spec) {
 			return buildAddrSpec((ASTaddr_spec)n);
 		}
@@ -126,7 +127,7 @@
 
 	private NamedMailbox buildNameAddr(ASTname_addr node) {
 		ChildNodeIterator it = new ChildNodeIterator(node);
-		Node n = it.nextNode();
+		Node n = it.next();
 		String name;
 		if (n instanceof ASTphrase) {
 			name = buildString((ASTphrase)n, false);
@@ -135,7 +136,7 @@
 			throw new IllegalStateException();
 		}
 		
-		n = it.nextNode();
+		n = it.next();
 		if (n instanceof ASTangle_addr) {
             name = DecoderUtil.decodeEncodedWords(name);
 			return new NamedMailbox(name, buildAngleAddr((ASTangle_addr) n));
@@ -148,10 +149,10 @@
 	private Mailbox buildAngleAddr(ASTangle_addr node) {
 		ChildNodeIterator it = new ChildNodeIterator(node);
 		DomainList route = null;
-		Node n = it.nextNode();
+		Node n = it.next();
 		if (n instanceof ASTroute) {
 			route = buildRoute((ASTroute)n);
-			n = it.nextNode();
+			n = it.next();
 		}
 		else if (n instanceof ASTaddr_spec)
 			; // do nothing
@@ -165,10 +166,10 @@
 	}
 
 	private DomainList buildRoute(ASTroute node) {
-		ArrayList results = new ArrayList(node.jjtGetNumChildren());
+		List<String> results = new ArrayList<String>(node.jjtGetNumChildren());
 		ChildNodeIterator it = new ChildNodeIterator(node);
 		while (it.hasNext()) {
-			Node n = it.nextNode();
+			Node n = it.next();
 			if (n instanceof ASTdomain)
 				results.add(buildString((ASTdomain)n, true));
 			else
@@ -182,8 +183,8 @@
 	}
 	private Mailbox buildAddrSpec(DomainList route, ASTaddr_spec node) {
 		ChildNodeIterator it = new ChildNodeIterator(node);
-		String localPart = buildString((ASTlocal_part)it.nextNode(), true);
-		String domain = buildString((ASTdomain)it.nextNode(), true);
+		String localPart = buildString((ASTlocal_part)it.next(), true);
+		String domain = buildString((ASTdomain)it.next(), true);
 		return new Mailbox(route, localPart, domain);		
 	}
 
@@ -191,7 +192,7 @@
 	private String buildString(SimpleNode node, boolean stripSpaces) {
 		Token head = node.firstToken;
 		Token tail = node.lastToken;
-		StringBuffer out = new StringBuffer();
+		StringBuilder out = new StringBuilder();
 		
 		while (head != tail) {
 			out.append(head.image);
@@ -204,14 +205,14 @@
 		return out.toString();
 	}
 
-	private void addSpecials(StringBuffer out, Token specialToken) {
+	private void addSpecials(StringBuilder out, Token specialToken) {
 		if (specialToken != null) {
 			addSpecials(out, specialToken.specialToken);
 			out.append(specialToken.image);
 		}
 	}
 
-	private static class ChildNodeIterator implements Iterator {
+	private static class ChildNodeIterator implements Iterator<Node> {
 
 		private SimpleNode simpleNode;
 		private int index;
@@ -231,11 +232,7 @@
 			return index < len;
 		}
 
-		public Object next() {
-			return nextNode();
-		}
-		
-		public Node nextNode() {
+		public Node next() {
 			return simpleNode.jjtGetChild(index++);
 		}
 		

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java Sun Nov 16 04:56:20 2008
@@ -20,6 +20,7 @@
 package org.apache.james.mime4j.field.address;
 
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * An immutable, random-access list of Strings (that 
@@ -28,17 +29,17 @@
  * 
  */
 public class DomainList {
-	private ArrayList domains;
+	private List<String> domains;
 	
 	/**
-	 * @param domains An ArrayList that contains only String objects. 
+	 * @param domains A List that contains only String objects. 
 	 * @param dontCopy true iff it is not possible for the domains ArrayList to be modified by someone else.
 	 */
-	public DomainList(ArrayList domains, boolean dontCopy) {
+	public DomainList(List<String> domains, boolean dontCopy) {
 		if (domains != null)
-			this.domains = (dontCopy ? domains : (ArrayList) domains.clone());
+			this.domains = dontCopy ? domains :  new ArrayList<String>(domains);
 		else
-			this.domains = new ArrayList(0);
+			this.domains = new ArrayList<String>(0);
 	}
 	
 	/**
@@ -56,7 +57,7 @@
 	public String get(int index) {
 		if (0 > index || size() <= index)
 			throw new IndexOutOfBoundsException();
-		return (String) domains.get(index);
+		return domains.get(index);
 	}
 
 	/**
@@ -64,7 +65,7 @@
 	 * string (not including the trailing ':'). 
 	 */
 	public String toRouteString() {
-		StringBuffer out = new StringBuffer();
+		StringBuilder out = new StringBuilder();
 		for (int i = 0; i < domains.size(); i++) {
 			out.append("@");
 			out.append(get(i));

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Group.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Group.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Group.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Group.java Sun Nov 16 04:56:20 2008
@@ -19,7 +19,7 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.ArrayList;
+import java.util.List;
 
 /**
  * A named group of zero or more mailboxes.  
@@ -53,8 +53,9 @@
 		return mailboxList;
 	}
 	
+	@Override
 	public String toString() {
-		StringBuffer buf = new StringBuffer();
+		StringBuilder buf = new StringBuilder();
 		buf.append(name);
 		buf.append(":");
 		for (int i = 0; i < mailboxList.size(); i++) {
@@ -66,7 +67,8 @@
 		return buf.toString();
 	}
 
-	protected void doAddMailboxesTo(ArrayList results) {
+	@Override
+	protected void doAddMailboxesTo(List<Mailbox> results) {
 		for (int i = 0; i < mailboxList.size(); i++)
 			results.add(mailboxList.get(i));
 	}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java Sun Nov 16 04:56:20 2008
@@ -19,7 +19,7 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Represents a single e-mail address. 
@@ -109,10 +109,12 @@
 			+ domain + ">";  
 	}
 	
-	protected final void doAddMailboxesTo(ArrayList results) {
+	@Override
+	protected final void doAddMailboxesTo(List<Mailbox> results) {
 		results.add(this);
 	}
 	
+	@Override
 	public String toString() {
 		return getAddressString();
 	}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java Sun Nov 16 04:56:20 2008
@@ -20,6 +20,7 @@
 package org.apache.james.mime4j.field.address;
 
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * An immutable, random-access list of Mailbox objects.
@@ -28,17 +29,17 @@
  */
 public class MailboxList {
 
-	private ArrayList mailboxes;
+	private List<Mailbox> mailboxes;
 	
 	/**
-	 * @param mailboxes An ArrayList that contains only Mailbox objects. 
+	 * @param mailboxes A List that contains only Mailbox objects. 
 	 * @param dontCopy true iff it is not possible for the mailboxes ArrayList to be modified by someone else.
 	 */
-	public MailboxList(ArrayList mailboxes, boolean dontCopy) {
+	public MailboxList(List<Mailbox> mailboxes, boolean dontCopy) {
 		if (mailboxes != null)
-			this.mailboxes = (dontCopy ? mailboxes : (ArrayList) mailboxes.clone());
+			this.mailboxes = dontCopy ? mailboxes : new ArrayList<Mailbox>(mailboxes);
 		else
-			this.mailboxes = new ArrayList(0);
+			this.mailboxes = new ArrayList<Mailbox>(0);
 	}
 	
 	/**
@@ -54,7 +55,7 @@
 	public Mailbox get(int index) {
 		if (0 > index || size() <= index)
 			throw new IndexOutOfBoundsException();
-		return (Mailbox) mailboxes.get(index);
+		return mailboxes.get(index);
 	}
 	
 	/**

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/NamedMailbox.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/NamedMailbox.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/NamedMailbox.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/NamedMailbox.java Sun Nov 16 04:56:20 2008
@@ -64,6 +64,7 @@
 	 * 
 	 * @see Mailbox#getAddressString(boolean) 
 	 */
+	@Override
 	public String getAddressString(boolean includeRoute) {
 		return (name == null ? "" : name + " ") + super.getAddressString(includeRoute);
 	}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/datetime/DateTime.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/datetime/DateTime.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/datetime/DateTime.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/datetime/DateTime.java Sun Nov 16 04:56:20 2008
@@ -110,10 +110,12 @@
         System.out.println(toString());
     }
 
+    @Override
     public String toString() {
         return getYear() + " " + getMonth() + " " + getDay() + "; " + getHour() + " " + getMinute() + " " + getSecond() + " " + getTimeZone();
     }
 
+    @Override
     public int hashCode() {
         final int PRIME = 31;
         int result = 1;
@@ -128,6 +130,7 @@
         return result;
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (this == obj)
             return true;

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java Sun Nov 16 04:56:20 2008
@@ -101,6 +101,7 @@
         return this.bufpos < this.buflen;
     }
 
+    @Override
     public int read() throws IOException {
         int noRead = 0;
         while (!hasBufferedData()) {
@@ -112,6 +113,7 @@
         return this.buffer[this.bufpos++] & 0xff;
     }
     
+    @Override
     public int read(final byte[] b, int off, int len) throws IOException {
         if (b == null) {
             return 0;
@@ -132,6 +134,7 @@
         return chunk;
     }
     
+    @Override
     public int read(final byte[] b) throws IOException {
         if (b == null) {
             return 0;
@@ -139,11 +142,13 @@
         return read(b, 0, b.length);
     }
     
+    @Override
     public boolean markSupported() {
         return false;
     }
 
     
+    @Override
     public int readLine(final ByteArrayBuffer dst) throws IOException {
         if (dst == null) {
             throw new IllegalArgumentException("Buffer may not be null");
@@ -300,8 +305,9 @@
         this.buflen = 0;
     }
     
+    @Override
     public String toString() {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append("[pos: ");
         buffer.append(this.bufpos);
         buffer.append("]");

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/EOLConvertingInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/EOLConvertingInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/EOLConvertingInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/EOLConvertingInputStream.java Sun Nov 16 04:56:20 2008
@@ -73,6 +73,7 @@
      * 
      * @throws IOException on I/O errors.
      */
+    @Override
     public void close() throws IOException {
         in.close();
     }
@@ -80,6 +81,7 @@
     /**
      * @see java.io.InputStream#read()
      */
+    @Override
     public int read() throws IOException {
         int b = in.read();
         

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LimitedInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LimitedInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LimitedInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LimitedInputStream.java Sun Nov 16 04:56:20 2008
@@ -40,17 +40,20 @@
         }
     }
     
+    @Override
     public int read() throws IOException {
         enforceLimit();
         return super.read();
     }
 
+    @Override
     public int read(byte b[], int off, int len) throws IOException {
         enforceLimit();
         len = Math.min(len, getBytesLeft());
         return super.read(b, off, len);
     }
 
+    @Override
     public long skip(long n) throws IOException {
         enforceLimit();
         n = Math.min(n, getBytesLeft());

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java Sun Nov 16 04:56:20 2008
@@ -56,6 +56,7 @@
         this(is, -1);
     }
     
+    @Override
     public int read() throws IOException {
         int i = in.read();
         this.eof = i == -1;
@@ -63,6 +64,7 @@
         return i;
     }
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         int i = in.read(b, off, len);
         this.eof = i == -1;
@@ -70,6 +72,7 @@
         return i;
     }
     
+    @Override
     public int readLine(final ByteArrayBuffer dst) throws IOException {
         int i;
         if (this.bis != null) {
@@ -110,6 +113,7 @@
         return this.used;
     }
     
+    @Override
     public String toString() {
         return "[LineReaderInputStreamAdaptor: " + bis + "]";
     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MimeBoundaryInputStream.java Sun Nov 16 04:56:20 2008
@@ -82,12 +82,14 @@
      * 
      * @throws IOException on I/O errors.
      */
+    @Override
     public void close() throws IOException {
     }
 
     /**
      * @see java.io.InputStream#markSupported()
      */
+    @Override
     public boolean markSupported() {
         return false;
     }
@@ -95,6 +97,7 @@
     /**
      * @see java.io.InputStream#read()
      */
+    @Override
     public int read() throws IOException {
         if (completed) {
             return -1;
@@ -114,6 +117,7 @@
         }
     }
     
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         if (completed) {
             return -1;
@@ -130,6 +134,7 @@
         return buffer.read(b, off, chunk);
     }
 
+    @Override
     public int readLine(final ByteArrayBuffer dst) throws IOException {
         if (dst == null) {
             throw new IllegalArgumentException("Destination buffer may not be null");
@@ -284,10 +289,11 @@
         return eof && !buffer.hasBufferedData();
     }
 
+    @Override
     public String toString() {
-        final StringBuffer buffer = new StringBuffer("MimeBoundaryInputStream, boundary ");
-        for (int i = 0; i < boundary.length; i++) {
-            buffer.append((char) boundary[i]);
+        final StringBuilder buffer = new StringBuilder("MimeBoundaryInputStream, boundary ");
+        for (byte b : boundary) {
+            buffer.append((char) b);
         }
         return buffer.toString();
     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/PositionInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/PositionInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/PositionInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/PositionInputStream.java Sun Nov 16 04:56:20 2008
@@ -37,10 +37,12 @@
         return position;
     }
 
+    @Override
     public int available() throws IOException {
         return in.available();
     }
 
+    @Override
     public int read() throws IOException {
         int b = in.read();
         if (b != -1)
@@ -48,24 +50,29 @@
         return b;
     }
 
+    @Override
     public void close() throws IOException {
         in.close();
     }
 
+    @Override
     public void reset() throws IOException {
         in.reset();
         position = markedPosition;
     }
 
+    @Override
     public boolean markSupported() {
         return in.markSupported();
     }
 
+    @Override
     public void mark(int readlimit) {
         in.mark(readlimit);
         markedPosition = position;
     }
 
+    @Override
     public long skip(long n) throws IOException {
         final long c = in.skip(n);
         if (c > 0) 
@@ -73,6 +80,7 @@
         return c;
     }
 
+    @Override
     public int read(byte b[], int off, int len) throws IOException {
         final int c = in.read(b, off, len);
         if (c > 0) 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/RootInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/RootInputStream.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/RootInputStream.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/RootInputStream.java Sun Nov 16 04:56:20 2008
@@ -67,6 +67,7 @@
     /**
      * @see java.io.InputStream#read()
      */
+    @Override
     public int read() throws IOException {
         if (truncated) {
             return -1;
@@ -84,6 +85,7 @@
      * 
      * @see java.io.InputStream#read(byte[], int, int)
      */
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         if (truncated) {
             return -1;

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Body.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Body.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Body.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Body.java Sun Nov 16 04:56:20 2008
@@ -23,7 +23,6 @@
 import java.io.OutputStream;
 
 import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.util.MessageUtils;
 
 /**
  * Encapsulates the body of an entity (see RFC 2045).
@@ -51,9 +50,8 @@
      * Writes this body to the given stream in MIME message format.
      * 
      * @param out the stream to write to.
-     * @param mode compatibility mode:
-     *   {@link MessageUtils#LENIENT}, {@link MessageUtils#STRICT_ERROR}, {@link MessageUtils#STRICT_IGNORE}  
+     * @param mode compatibility mode  
      * @throws IOException on I/O errors.
      */
-    void writeTo(OutputStream out, int mode) throws IOException, MimeException;
+    void writeTo(OutputStream out, Mode mode) throws IOException, MimeException;
 }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Entity.java Sun Nov 16 04:56:20 2008
@@ -24,7 +24,6 @@
 import org.apache.james.mime4j.field.ContentTransferEncodingField;
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.Field;
-import org.apache.james.mime4j.util.MessageUtils;
 import org.apache.james.mime4j.util.MimeUtil;
 
 import java.io.IOException;
@@ -168,11 +167,10 @@
      * Write the content to the given outputstream
      * 
      * @param out the outputstream to write to
-     * @param mode compatibility mode:
-     *   {@link MessageUtils#LENIENT}, {@link MessageUtils#STRICT_ERROR}, {@link MessageUtils#STRICT_IGNORE}  
+     * @param mode compatibility mode  
      * @throws IOException 
      */
-    public void writeTo(OutputStream out, int mode) throws IOException, MimeException {
+    public void writeTo(OutputStream out, Mode mode) throws IOException, MimeException {
         getHeader().writeTo(out, mode);
         
         out.flush();

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java Sun Nov 16 04:56:20 2008
@@ -50,8 +50,8 @@
  * @version $Id: Header.java,v 1.3 2004/10/04 15:36:44 ntherning Exp $
  */
 public class Header {
-    private List fields = new LinkedList();
-    private Map/*<String, List<Field>>*/ fieldMap = new HashMap();
+    private List<Field> fields = new LinkedList<Field>();
+    private Map<String, List<Field>> fieldMap = new HashMap<String, List<Field>>();
     
     /**
      * Creates a new empty <code>Header</code>.
@@ -71,9 +71,11 @@
             throws IOException, MimeIOException {
         final MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
+            @Override
             public void endHeader() {
                 parser.stop();
             }
+            @Override
             public void field(String fieldData) throws MimeException {
                 addField(Field.parse(fieldData));
             }
@@ -91,9 +93,9 @@
      * @param field the field to add.
      */
     public void addField(Field field) {
-        List values = (List) fieldMap.get(field.getName().toLowerCase());
+        List<Field> values = fieldMap.get(field.getName().toLowerCase());
         if (values == null) {
-            values = new LinkedList();
+            values = new LinkedList<Field>();
             fieldMap.put(field.getName().toLowerCase(), values);
         }
         values.add(field);
@@ -106,7 +108,7 @@
      * 
      * @return the list of <code>Field</code> objects.
      */
-    public List getFields() {
+    public List<Field> getFields() {
         return Collections.unmodifiableList(fields);
     }
 
@@ -118,9 +120,9 @@
      * @return the field or <code>null</code> if none found.
      */
     public Field getField(String name) {
-        List l = (List) fieldMap.get(name.toLowerCase());
+        List<Field> l = fieldMap.get(name.toLowerCase());
         if (l != null && !l.isEmpty()) {
-            return (Field) l.get(0);
+            return l.get(0);
         }
         return null;
     }
@@ -131,12 +133,12 @@
      * @param name the field name (e.g. From, Subject).
      * @return the list of fields.
      */
-    public List getFields(final String name) {
+    public List<Field> getFields(final String name) {
         final String lowerCaseName = name.toLowerCase();
-        final List l = (List) fieldMap.get(lowerCaseName);
-        final List results;
+        final List<Field> l = fieldMap.get(lowerCaseName);
+        final List<Field> results;
         if (l == null || l.isEmpty()) {
-            results = Collections.EMPTY_LIST;
+            results = Collections.emptyList();
         } else {
             results = Collections.unmodifiableList(l);
         }
@@ -152,12 +154,12 @@
      */
     public int removeFields(String name) {
         final String lowerCaseName = name.toLowerCase();
-        List removed = (List) fieldMap.remove(lowerCaseName);
+        List<Field> removed = fieldMap.remove(lowerCaseName);
         if (removed == null || removed.isEmpty())
             return 0;
 
-        for (Iterator iterator = fields.iterator(); iterator.hasNext();) {
-            Field field = (Field) iterator.next();
+        for (Iterator<Field> iterator = fields.iterator(); iterator.hasNext();) {
+            Field field = iterator.next();
             if (field.getName().equalsIgnoreCase(name))
                 iterator.remove();
         }
@@ -179,7 +181,7 @@
      */
     public void setField(Field field) {
         final String lowerCaseName = field.getName().toLowerCase();
-        List l = (List) fieldMap.get(lowerCaseName);
+        List<Field> l = fieldMap.get(lowerCaseName);
         if (l == null || l.isEmpty()) {
             addField(field);
             return;
@@ -190,8 +192,8 @@
 
         int firstOccurrence = -1;
         int index = 0;
-        for (Iterator iterator = fields.iterator(); iterator.hasNext(); index++) {
-            Field f = (Field) iterator.next();
+        for (Iterator<Field> iterator = fields.iterator(); iterator.hasNext(); index++) {
+            Field f = iterator.next();
             if (f.getName().equalsIgnoreCase(field.getName())) {
                 iterator.remove();
 
@@ -209,10 +211,11 @@
      * 
      * @return headers
      */
+    @Override
     public String toString() {
         CharArrayBuffer str = new CharArrayBuffer(128);
-        for (Iterator it = fields.iterator(); it.hasNext();) {
-            str.append(it.next().toString());
+        for (Field field : fields) {
+            str.append(field.toString());
             str.append("\r\n");
         }
         return str.toString();
@@ -242,9 +245,9 @@
      * @throws IOException if case of an I/O error
      * @throws MimeException if case of a MIME protocol violation
      */
-    public void writeTo(final OutputStream out, int mode) throws IOException, MimeException {
+    public void writeTo(final OutputStream out, Mode mode) throws IOException, MimeException {
         Charset charset = null;
-        if (mode == MessageUtils.LENIENT) {
+        if (mode == Mode.LENIENT) {
             final ContentTypeField contentTypeField = ((ContentTypeField) getField(Field.CONTENT_TYPE));
             if (contentTypeField == null) {
                 charset = MessageUtils.DEFAULT_CHARSET;
@@ -261,10 +264,9 @@
         }
         BufferedWriter writer = new BufferedWriter(
                 new OutputStreamWriter(out, charset), 8192);
-        for (Iterator it = fields.iterator(); it.hasNext();) {
-            Field field = (Field) it.next();
+        for (Field field : fields) {
             String fs = field.toString();
-            if (mode == MessageUtils.STRICT_ERROR && !MessageUtils.isASCII(fs)) {
+            if (mode == Mode.STRICT_ERROR && !MessageUtils.isASCII(fs)) {
                 throw new MimeException("Header '" + fs + "' violates RFC 822");
             }
             writer.write(fs);

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java Sun Nov 16 04:56:20 2008
@@ -35,13 +35,13 @@
 public class MessageBuilder implements ContentHandler {
 
     private final Entity entity;
-    private Stack stack = new Stack();
+    private Stack<Object> stack = new Stack<Object>();
     
     public MessageBuilder(Entity entity) {
         this.entity = entity;
     }
     
-    private void expect(Class c) {
+    private void expect(Class<?> c) {
         if (!c.isInstance(stack.peek())) {
             throw new IllegalStateException("Internal stack error: "
                     + "Expected '" + c.getName() + "' found '"

Added: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Mode.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Mode.java?rev=718018&view=auto
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Mode.java (added)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Mode.java Sun Nov 16 04:56:20 2008
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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.mime4j.message;
+
+public class Mode {
+
+    // because of a problem with the retrotranslator maven plugin this class
+    // uses the old typesafe enum pattern instead of a native Java 5 enum
+
+    public static final Mode STRICT_IGNORE = new Mode();
+    public static final Mode STRICT_ERROR = new Mode();
+    public static final Mode LENIENT = new Mode();
+
+    private Mode() {
+    }
+
+}

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Multipart.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Multipart.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Multipart.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Multipart.java Sun Nov 16 04:56:20 2008
@@ -25,7 +25,6 @@
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -48,7 +47,7 @@
 public class Multipart implements Body {
     private String preamble = "";
     private String epilogue = "";
-    private List bodyParts = new LinkedList();
+    private List<BodyPart> bodyParts = new LinkedList<BodyPart>();
     private Entity parent = null;
     private String subType;
 
@@ -93,8 +92,8 @@
      */
     public void setParent(Entity parent) {
         this.parent = parent;
-        for (Iterator it = bodyParts.iterator(); it.hasNext();) {
-            ((BodyPart) it.next()).setParent(parent);
+        for (BodyPart bodyPart : bodyParts) {
+            bodyPart.setParent(parent);
         }
     }
 
@@ -121,7 +120,7 @@
      * 
      * @return the list of <code>BodyPart</code> objects.
      */
-    public List getBodyParts() {
+    public List<BodyPart> getBodyParts() {
         return Collections.unmodifiableList(bodyParts);
     }
     
@@ -130,10 +129,10 @@
      * 
      * @param bodyParts the new list of <code>BodyPart</code> objects.
      */
-    public void setBodyParts(List bodyParts) {
+    public void setBodyParts(List<BodyPart> bodyParts) {
         this.bodyParts = bodyParts;
-        for (Iterator it = bodyParts.iterator(); it.hasNext();) {
-            ((BodyPart) it.next()).setParent(parent);
+        for (BodyPart bodyPart : bodyParts) {
+            bodyPart.setParent(parent);
         }
     }
     
@@ -174,7 +173,7 @@
      * @throws IOException if case of an I/O error
      * @throws MimeException if case of a MIME protocol violation
      */
-    public void writeTo(final OutputStream out, int mode) throws IOException, MimeException {
+    public void writeTo(final OutputStream out, Mode mode) throws IOException, MimeException {
         Entity e = getParent();
         
         ContentTypeField cField = (ContentTypeField) e.getHeader().getField(
@@ -185,7 +184,7 @@
         String boundary = cField.getBoundary();
 
         Charset charset = null;
-        if (mode == MessageUtils.LENIENT) {
+        if (mode == Mode.LENIENT) {
             if (cField != null && cField.getCharset() != null) {
                 charset = CharsetUtil.getCharset(cField.getCharset());
             } else {
@@ -198,7 +197,7 @@
         BufferedWriter writer = new BufferedWriter(
                 new OutputStreamWriter(out, charset), 8192);
         
-        List bodyParts = getBodyParts();
+        List<BodyPart> bodyParts = getBodyParts();
 
         writer.write(getPreamble());
         writer.write(MessageUtils.CRLF);
@@ -208,7 +207,7 @@
             writer.write(boundary);
             writer.write(MessageUtils.CRLF);
             writer.flush();
-            final BodyPart bodyPart = (BodyPart) bodyParts.get(i);
+            final BodyPart bodyPart = bodyParts.get(i);
             bodyPart.writeTo(out, mode);
             writer.write(MessageUtils.CRLF);
         }
@@ -229,8 +228,8 @@
      * @see org.apache.james.mime4j.message.Disposable#dispose()
      */
     public void dispose() {
-        for (Iterator it = bodyParts.iterator(); it.hasNext();) {
-            ((BodyPart) it.next()).dispose();
+        for (BodyPart bodyPart : bodyParts) {
+            bodyPart.dispose();
         }
     }
 

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java Sun Nov 16 04:56:20 2008
@@ -66,6 +66,7 @@
     /**
      * @see org.apache.james.mime4j.parser.AbstractContentHandler#startHeader()
      */
+    @Override
     public final void startHeader() {
         currHeader = new Header();
     }
@@ -73,6 +74,7 @@
     /**
      * @see org.apache.james.mime4j.parser.AbstractContentHandler#field(java.lang.String)
      */
+    @Override
     public final void field(String fieldData) throws MimeException {
         currHeader.addField(Field.parse(fieldData));
     }
@@ -80,6 +82,7 @@
     /**
      * @see org.apache.james.mime4j.parser.AbstractContentHandler#endHeader()
      */
+    @Override
     public final void endHeader() {
         Header tmp = currHeader;
         currHeader = null;
@@ -89,6 +92,7 @@
     /**
      * @see org.apache.james.mime4j.parser.AbstractContentHandler#body(org.apache.james.mime4j.descriptor.BodyDescriptor, java.io.InputStream)
      */
+    @Override
     public final void body(BodyDescriptor bd, InputStream is) throws IOException {
         if (MimeUtil.isBase64Encoding(bd.getTransferEncoding())) {
             bodyDecoded(bd, new Base64InputStream(is));

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileBinaryBody.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileBinaryBody.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileBinaryBody.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileBinaryBody.java Sun Nov 16 04:56:20 2008
@@ -63,9 +63,9 @@
     }
     
     /**
-     * @see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream, int)
+     * @see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream, Mode)
      */
-    public void writeTo(OutputStream out, int mode) throws IOException {
+    public void writeTo(OutputStream out, Mode mode) throws IOException {
         final InputStream inputStream = getInputStream();
         CodecUtil.copy(inputStream,out);
     }
@@ -75,6 +75,7 @@
      * 
      * @see org.apache.james.mime4j.message.Disposable#dispose()
      */
+    @Override
     public void dispose() {
         if (tempFile != null) {
             tempFile.delete();

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileTextBody.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileTextBody.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileTextBody.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TempFileTextBody.java Sun Nov 16 04:56:20 2008
@@ -101,9 +101,9 @@
     
     
     /**
-     * @see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream, int)
+     * @see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream, Mode)
      */
-    public void writeTo(OutputStream out, int mode) throws IOException {
+    public void writeTo(OutputStream out, Mode mode) throws IOException {
         final InputStream inputStream = tempFile.getInputStream();
         CodecUtil.copy(inputStream, out);
     }
@@ -113,6 +113,7 @@
      * 
      * @see org.apache.james.mime4j.message.Disposable#dispose()
      */
+    @Override
     public void dispose() {
         if (tempFile != null) {
             tempFile.delete();

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/storage/SimpleTempStorage.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/storage/SimpleTempStorage.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/storage/SimpleTempStorage.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/storage/SimpleTempStorage.java Sun Nov 16 04:56:20 2008
@@ -115,6 +115,7 @@
     /**
      * @see org.apache.james.mime4j.message.storage.TempStorage#getRootTempPath()
      */
+    @Override
     public TempPath getRootTempPath() {
         return rootPath;
     }
@@ -188,7 +189,7 @@
     private static class SimpleTempFile implements TempFile {
         private File file = null;
 
-        private static final Set filesToDelete = new HashSet();
+        private static final Set<File> filesToDelete = new HashSet<File>();
 
         private SimpleTempFile(File file) {
             this.file = file;
@@ -234,9 +235,9 @@
                     file = null;
                 }
 
-                for (Iterator iterator = filesToDelete.iterator(); iterator
+                for (Iterator<File> iterator = filesToDelete.iterator(); iterator
                         .hasNext();) {
-                    File file = (File) iterator.next();
+                    File file = iterator.next();
                     if (file.delete())
                         iterator.remove();
                 }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java Sun Nov 16 04:56:20 2008
@@ -341,6 +341,7 @@
         }
     }
 
+    @Override
     public String toString() {
         return getClass().getName() + " [" + stateToString(state)
         + "][" + body.getMimeType() + "][" + body.getBoundary() + "]";

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/Event.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/Event.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/Event.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/Event.java Sun Nov 16 04:56:20 2008
@@ -46,10 +46,12 @@
         this.code = code;
     }
     
+    @Override
     public int hashCode() {
         return code.hashCode();
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (obj == null) return false;
         if (this == obj) return true;
@@ -61,6 +63,7 @@
         }
     }
     
+    @Override
     public String toString() {
         return code;
     }

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntity.java?rev=718018&r1=718017&r2=718018&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntity.java (original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/parser/MimeEntity.java Sun Nov 16 04:56:20 2008
@@ -97,10 +97,12 @@
         body.addField("Content-Type", contentType);
     }
     
+    @Override
     protected int getLineNumber() {
         return rootStream.getLineNumber();
     }
     
+    @Override
     protected LineReaderInputStream getDataStream() {
         return dataStream;
     }



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