Author: mwiederkehr
Date: Wed Dec 31 06:18:53 2008
New Revision: 730402

URL: http://svn.apache.org/viewvc?rev=730402&view=rev
Log:
eliminated tab characters from source code; no functional changes.

Modified:
    
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/decoder/QuotedPrintableOutputStream.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/test/java/org/apache/james/mime4j/message/HeaderTest.java

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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -40,14 +40,15 @@
 
     @Override
     public void close() throws IOException {
-       if (closed) return;
+        if (closed)
+            return;
 
-       try {
+        try {
             encoder.completeEncoding();
             // do not close the wrapped stream
-       } finally {
-               closed = true;
-       }
+        } finally {
+            closed = true;
+        }
     }
 
     @Override

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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -22,31 +22,26 @@
 import java.util.List;
 
 /**
- * The abstract base for classes that represent RFC2822 addresses.
- * This includes groups and mailboxes.
+ * The abstract base for classes that represent RFC2822 addresses. This 
includes
+ * groups and mailboxes.
  * 
  * Currently, no public methods are introduced on this class.
- * 
- * 
  */
 public abstract class Address {
 
-       /**
-        * Adds any mailboxes represented by this address
-        * 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(List<Mailbox> results) {
-               doAddMailboxesTo(results);
-       }
-       
-       /**
-        * Adds any mailboxes represented by this address
-        * into the given List. Must be overridden by
-        * concrete subclasses.
-        */
-       protected abstract void doAddMailboxesTo(List<Mailbox> results);
+    /**
+     * Adds any mailboxes represented by this address 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(List<Mailbox> results) {
+        doAddMailboxesTo(results);
+    }
+
+    /**
+     * Adds any mailboxes represented by this address into the given List. Must
+     * be overridden by concrete subclasses.
+     */
+    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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -28,115 +28,116 @@
 
 /**
  * An immutable, random-access list of Address objects.
- *
- * 
  */
 public class AddressList {
-       
-       private List<? extends Address> addresses;
 
-       /**
-        * @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(List<? extends Address> addresses, boolean dontCopy) 
{
-               if (addresses != null)
-                       this.addresses = dontCopy ? addresses : new 
ArrayList<Address>(addresses);
-               else
-                       this.addresses = new ArrayList<Address>(0);
-       }
-
-       /**
-        * The number of elements in this list.
-        */
-       public int size() {
-               return addresses.size();
-       }
-
-       /**
-        * Gets an address. 
-        */
-       public Address get(int index) {
-               if (0 > index || size() <= index)
-                       throw new IndexOutOfBoundsException();
-               return addresses.get(index);
-       }
-
-       /**
-        * Returns a flat list of all mailboxes represented
-        * in this address list. Use this if you don't care
-        * about grouping. 
-        */
-       public MailboxList flatten() {
-               // in the common case, all addresses are mailboxes
-               boolean groupDetected = false;
-               for (Address addr : addresses) {
-                       if (!(addr instanceof Mailbox)) {
-                               groupDetected = true;
-                               break;
-                       }
-               }
-               
-               if (!groupDetected) {
-                       @SuppressWarnings("unchecked")
-                       final List<Mailbox> mailboxes = (List<Mailbox>) 
addresses; 
-                       return new MailboxList(mailboxes, true);
-               }
-               
-               List<Mailbox> results = new ArrayList<Mailbox>();
-               for (Address addr : addresses) {
-                       addr.addMailboxesTo(results);
-               }
-               
-               // copy-on-construct this time, because subclasses
-               // could have held onto a reference to the results
-               return new MailboxList(results, false);
-       }
-       
-       /**
-        * Dumps a representation of this address list to
-        * stdout, for debugging purposes.
-        */
-       public void print() {
-               for (Address addr : addresses) {
-                       System.out.println(addr.toString());
-               }
-       }
-
-
-
-       /**
-        * Parse the address list string, such as the value 
-        * of a From, To, Cc, Bcc, Sender, or Reply-To
-        * header.
-        * 
-        * The string MUST be unfolded already.
-        */
-       public static AddressList parse(String rawAddressList) throws 
ParseException {
-               AddressListParser parser = new AddressListParser(new 
StringReader(rawAddressList));
-               return Builder.getInstance().buildAddressList(parser.parse());
-       }
-       
-       /**
-        * Test console.
-        */
-       public static void main(String[] args) throws Exception {
-               java.io.BufferedReader reader = new java.io.BufferedReader(new 
java.io.InputStreamReader(System.in));
-               while (true) {
-                       try {
-                               System.out.print("> ");
-                               String line = reader.readLine();
-                               if (line.length() == 0 || 
line.toLowerCase().equals("exit") || line.toLowerCase().equals("quit")) {
-                                       System.out.println("Goodbye.");
-                                       return;
-                               }
-                               AddressList list = parse(line);
-                               list.print();
-                       }
-                       catch(Exception e) {
-                               e.printStackTrace();
-                               Thread.sleep(300);
-                       }
-               }
-       }
+    private List<? extends Address> addresses;
+
+    /**
+     * @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(List<? extends Address> addresses, boolean dontCopy) {
+        if (addresses != null)
+            this.addresses = dontCopy ? addresses : new ArrayList<Address>(
+                    addresses);
+        else
+            this.addresses = new ArrayList<Address>(0);
+    }
+
+    /**
+     * The number of elements in this list.
+     */
+    public int size() {
+        return addresses.size();
+    }
+
+    /**
+     * Gets an address.
+     */
+    public Address get(int index) {
+        if (0 > index || size() <= index)
+            throw new IndexOutOfBoundsException();
+        return addresses.get(index);
+    }
+
+    /**
+     * Returns a flat list of all mailboxes represented in this address list.
+     * Use this if you don't care about grouping.
+     */
+    public MailboxList flatten() {
+        // in the common case, all addresses are mailboxes
+        boolean groupDetected = false;
+        for (Address addr : addresses) {
+            if (!(addr instanceof Mailbox)) {
+                groupDetected = true;
+                break;
+            }
+        }
+
+        if (!groupDetected) {
+            @SuppressWarnings("unchecked")
+            final List<Mailbox> mailboxes = (List<Mailbox>) addresses;
+            return new MailboxList(mailboxes, true);
+        }
+
+        List<Mailbox> results = new ArrayList<Mailbox>();
+        for (Address addr : addresses) {
+            addr.addMailboxesTo(results);
+        }
+
+        // copy-on-construct this time, because subclasses
+        // could have held onto a reference to the results
+        return new MailboxList(results, false);
+    }
+
+    /**
+     * Dumps a representation of this address list to stdout, for debugging
+     * purposes.
+     */
+    public void print() {
+        for (Address addr : addresses) {
+            System.out.println(addr.toString());
+        }
+    }
+
+    /**
+     * Parse the address list string, such as the value of a From, To, Cc, Bcc,
+     * Sender, or Reply-To header.
+     * 
+     * The string MUST be unfolded already.
+     */
+    public static AddressList parse(String rawAddressList)
+            throws ParseException {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawAddressList));
+        return Builder.getInstance().buildAddressList(parser.parse());
+    }
+
+    /**
+     * Test console.
+     */
+    public static void main(String[] args) throws Exception {
+        java.io.BufferedReader reader = new java.io.BufferedReader(
+                new java.io.InputStreamReader(System.in));
+        while (true) {
+            try {
+                System.out.print("> ");
+                String line = reader.readLine();
+                if (line.length() == 0 || line.toLowerCase().equals("exit")
+                        || line.toLowerCase().equals("quit")) {
+                    System.out.println("Goodbye.");
+                    return;
+                }
+                AddressList list = parse(line);
+                list.print();
+            } catch (Exception e) {
+                e.printStackTrace();
+                Thread.sleep(300);
+            }
+        }
+    }
 }

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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -40,201 +40,185 @@
 import java.util.List;
 
 /**
- * Transforms the JJTree-generated abstract syntax tree
- * into a graph of org.apache.james.mime4j.field.address objects.
- *
- * 
+ * Transforms the JJTree-generated abstract syntax tree into a graph of
+ * org.apache.james.mime4j.field.address objects.
  */
 class Builder {
 
-       private static Builder singleton = new Builder();
-       
-       public static Builder getInstance() {
-               return singleton;
-       }
-       
-       
-       
-       public AddressList buildAddressList(ASTaddress_list node) {
-               List<Address> list = new ArrayList<Address>();
-               for (int i = 0; i < node.jjtGetNumChildren(); i++) {
-                       ASTaddress childNode = (ASTaddress) node.jjtGetChild(i);
-                       Address address = buildAddress(childNode);
-                       list.add(address);
-               }
-               return new AddressList(list, true);
-       }
-
-       private Address buildAddress(ASTaddress node) {
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               Node n = it.next();
-               if (n instanceof ASTaddr_spec) {
-                       return buildAddrSpec((ASTaddr_spec)n);
-               }
-               else if (n instanceof ASTangle_addr) {
-                       return buildAngleAddr((ASTangle_addr)n);
-               }
-               else if (n instanceof ASTphrase) {
-                       String name = buildString((ASTphrase)n, false);
-                       Node n2 = it.next();
-                       if (n2 instanceof ASTgroup_body) {
-                               return new Group(name, 
buildGroupBody((ASTgroup_body)n2));
-                       }
-                       else if (n2 instanceof ASTangle_addr) {
+    private static Builder singleton = new Builder();
+
+    public static Builder getInstance() {
+        return singleton;
+    }
+
+    public AddressList buildAddressList(ASTaddress_list node) {
+        List<Address> list = new ArrayList<Address>();
+        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+            ASTaddress childNode = (ASTaddress) node.jjtGetChild(i);
+            Address address = buildAddress(childNode);
+            list.add(address);
+        }
+        return new AddressList(list, true);
+    }
+
+    private Address buildAddress(ASTaddress node) {
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        Node n = it.next();
+        if (n instanceof ASTaddr_spec) {
+            return buildAddrSpec((ASTaddr_spec) n);
+        } else if (n instanceof ASTangle_addr) {
+            return buildAngleAddr((ASTangle_addr) n);
+        } else if (n instanceof ASTphrase) {
+            String name = buildString((ASTphrase) n, false);
+            Node n2 = it.next();
+            if (n2 instanceof ASTgroup_body) {
+                return new Group(name, buildGroupBody((ASTgroup_body) n2));
+            } else if (n2 instanceof ASTangle_addr) {
                 name = DecoderUtil.decodeEncodedWords(name);
-                               return new NamedMailbox(name, 
buildAngleAddr((ASTangle_addr)n2));
-                       }
-                       else {
-                               throw new IllegalStateException();
-                       }
-               }
-               else {
-                       throw new IllegalStateException();
-               }
-       }
-       
-       
-       
-       private MailboxList buildGroupBody(ASTgroup_body node) {
-               List<Mailbox> results = new ArrayList<Mailbox>();
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               while (it.hasNext()) {
-                       Node n = it.next();
-                       if (n instanceof ASTmailbox)
-                               results.add(buildMailbox((ASTmailbox)n));
-                       else
-                               throw new IllegalStateException();
-               }
-               return new MailboxList(results, true);
-       }
-
-       private Mailbox buildMailbox(ASTmailbox node) {
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               Node n = it.next();
-               if (n instanceof ASTaddr_spec) {
-                       return buildAddrSpec((ASTaddr_spec)n);
-               }
-               else if (n instanceof ASTangle_addr) {
-                       return buildAngleAddr((ASTangle_addr)n);
-               }
-               else if (n instanceof ASTname_addr) {
-                       return buildNameAddr((ASTname_addr)n);
-               }
-               else {
-                       throw new IllegalStateException();
-               }
-       }
-
-       private NamedMailbox buildNameAddr(ASTname_addr node) {
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               Node n = it.next();
-               String name;
-               if (n instanceof ASTphrase) {
-                       name = buildString((ASTphrase)n, false);
-               }
-               else {
-                       throw new IllegalStateException();
-               }
-               
-               n = it.next();
-               if (n instanceof ASTangle_addr) {
+                return new NamedMailbox(name,
+                        buildAngleAddr((ASTangle_addr) n2));
+            } else {
+                throw new IllegalStateException();
+            }
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    private MailboxList buildGroupBody(ASTgroup_body node) {
+        List<Mailbox> results = new ArrayList<Mailbox>();
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        while (it.hasNext()) {
+            Node n = it.next();
+            if (n instanceof ASTmailbox)
+                results.add(buildMailbox((ASTmailbox) n));
+            else
+                throw new IllegalStateException();
+        }
+        return new MailboxList(results, true);
+    }
+
+    private Mailbox buildMailbox(ASTmailbox node) {
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        Node n = it.next();
+        if (n instanceof ASTaddr_spec) {
+            return buildAddrSpec((ASTaddr_spec) n);
+        } else if (n instanceof ASTangle_addr) {
+            return buildAngleAddr((ASTangle_addr) n);
+        } else if (n instanceof ASTname_addr) {
+            return buildNameAddr((ASTname_addr) n);
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    private NamedMailbox buildNameAddr(ASTname_addr node) {
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        Node n = it.next();
+        String name;
+        if (n instanceof ASTphrase) {
+            name = buildString((ASTphrase) n, false);
+        } else {
+            throw new IllegalStateException();
+        }
+
+        n = it.next();
+        if (n instanceof ASTangle_addr) {
             name = DecoderUtil.decodeEncodedWords(name);
-                       return new NamedMailbox(name, 
buildAngleAddr((ASTangle_addr) n));
-               }
-               else {
-                       throw new IllegalStateException();
-               }
-       }
-       
-       private Mailbox buildAngleAddr(ASTangle_addr node) {
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               DomainList route = null;
-               Node n = it.next();
-               if (n instanceof ASTroute) {
-                       route = buildRoute((ASTroute)n);
-                       n = it.next();
-               }
-               else if (n instanceof ASTaddr_spec)
-                       ; // do nothing
-               else
-                       throw new IllegalStateException();
-               
-               if (n instanceof ASTaddr_spec)
-                       return buildAddrSpec(route, (ASTaddr_spec)n);
-               else
-                       throw new IllegalStateException();
-       }
-
-       private DomainList buildRoute(ASTroute node) {
-               List<String> results = new 
ArrayList<String>(node.jjtGetNumChildren());
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               while (it.hasNext()) {
-                       Node n = it.next();
-                       if (n instanceof ASTdomain)
-                               results.add(buildString((ASTdomain)n, true));
-                       else
-                               throw new IllegalStateException();
-               }
-               return new DomainList(results, true);
-       }
-
-       private Mailbox buildAddrSpec(ASTaddr_spec node) {
-               return buildAddrSpec(null, node);
-       }
-       private Mailbox buildAddrSpec(DomainList route, ASTaddr_spec node) {
-               ChildNodeIterator it = new ChildNodeIterator(node);
-               String localPart = buildString((ASTlocal_part)it.next(), true);
-               String domain = buildString((ASTdomain)it.next(), true);
-               return new Mailbox(route, localPart, domain);           
-       }
-
-
-       private String buildString(SimpleNode node, boolean stripSpaces) {
-               Token head = node.firstToken;
-               Token tail = node.lastToken;
-               StringBuilder out = new StringBuilder();
-               
-               while (head != tail) {
-                       out.append(head.image);
-                       head = head.next;
-                       if (!stripSpaces)
-                               addSpecials(out, head.specialToken);
-               }
-               out.append(tail.image);                 
-               
-               return out.toString();
-       }
-
-       private void addSpecials(StringBuilder out, Token specialToken) {
-               if (specialToken != null) {
-                       addSpecials(out, specialToken.specialToken);
-                       out.append(specialToken.image);
-               }
-       }
-
-       private static class ChildNodeIterator implements Iterator<Node> {
-
-               private SimpleNode simpleNode;
-               private int index;
-               private int len;
-               
-               public ChildNodeIterator(SimpleNode simpleNode) {
-                       this.simpleNode = simpleNode;
-                       this.len = simpleNode.jjtGetNumChildren();
-                       this.index = 0;
-               }
-               
-               public void remove() {
-                       throw new UnsupportedOperationException();
-               }
-
-               public boolean hasNext() {
-                       return index < len;
-               }
-
-               public Node next() {
-                       return simpleNode.jjtGetChild(index++);
-               }
-               
-       }
+            return new NamedMailbox(name, buildAngleAddr((ASTangle_addr) n));
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    private Mailbox buildAngleAddr(ASTangle_addr node) {
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        DomainList route = null;
+        Node n = it.next();
+        if (n instanceof ASTroute) {
+            route = buildRoute((ASTroute) n);
+            n = it.next();
+        } else if (n instanceof ASTaddr_spec)
+            ; // do nothing
+        else
+            throw new IllegalStateException();
+
+        if (n instanceof ASTaddr_spec)
+            return buildAddrSpec(route, (ASTaddr_spec) n);
+        else
+            throw new IllegalStateException();
+    }
+
+    private DomainList buildRoute(ASTroute node) {
+        List<String> results = new ArrayList<String>(node.jjtGetNumChildren());
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        while (it.hasNext()) {
+            Node n = it.next();
+            if (n instanceof ASTdomain)
+                results.add(buildString((ASTdomain) n, true));
+            else
+                throw new IllegalStateException();
+        }
+        return new DomainList(results, true);
+    }
+
+    private Mailbox buildAddrSpec(ASTaddr_spec node) {
+        return buildAddrSpec(null, node);
+    }
+
+    private Mailbox buildAddrSpec(DomainList route, ASTaddr_spec node) {
+        ChildNodeIterator it = new ChildNodeIterator(node);
+        String localPart = buildString((ASTlocal_part) it.next(), true);
+        String domain = buildString((ASTdomain) it.next(), true);
+        return new Mailbox(route, localPart, domain);
+    }
+
+    private String buildString(SimpleNode node, boolean stripSpaces) {
+        Token head = node.firstToken;
+        Token tail = node.lastToken;
+        StringBuilder out = new StringBuilder();
+
+        while (head != tail) {
+            out.append(head.image);
+            head = head.next;
+            if (!stripSpaces)
+                addSpecials(out, head.specialToken);
+        }
+        out.append(tail.image);
+
+        return out.toString();
+    }
+
+    private void addSpecials(StringBuilder out, Token specialToken) {
+        if (specialToken != null) {
+            addSpecials(out, specialToken.specialToken);
+            out.append(specialToken.image);
+        }
+    }
+
+    private static class ChildNodeIterator implements Iterator<Node> {
+
+        private SimpleNode simpleNode;
+        private int index;
+        private int len;
+
+        public ChildNodeIterator(SimpleNode simpleNode) {
+            this.simpleNode = simpleNode;
+            this.len = simpleNode.jjtGetNumChildren();
+            this.index = 0;
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean hasNext() {
+            return index < len;
+        }
+
+        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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -23,55 +23,57 @@
 import java.util.List;
 
 /**
- * An immutable, random-access list of Strings (that 
- * are supposedly domain names or domain literals).
- *
- * 
+ * An immutable, random-access list of Strings (that are supposedly domain 
names
+ * or domain literals).
  */
 public class DomainList {
-       private List<String> domains;
-       
-       /**
-        * @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(List<String> domains, boolean dontCopy) {
-               if (domains != null)
-                       this.domains = dontCopy ? domains :  new 
ArrayList<String>(domains);
-               else
-                       this.domains = new ArrayList<String>(0);
-       }
-       
-       /**
-        * The number of elements in this list.
-        */
-       public int size() {
-               return domains.size();
-       }
+    private List<String> domains;
 
-       /**
-        * Gets the domain name or domain literal at the
-        * specified index.
-        * @throws IndexOutOfBoundsException If index is &lt; 0 or &gt;= size().
-        */
-       public String get(int index) {
-               if (0 > index || size() <= index)
-                       throw new IndexOutOfBoundsException();
-               return domains.get(index);
-       }
+    /**
+     * @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(List<String> domains, boolean dontCopy) {
+        if (domains != null)
+            this.domains = dontCopy ? domains : new ArrayList<String>(domains);
+        else
+            this.domains = new ArrayList<String>(0);
+    }
 
-       /**
-        * Returns the list of domains formatted as a route
-        * string (not including the trailing ':'). 
-        */
-       public String toRouteString() {
-               StringBuilder out = new StringBuilder();
-               for (int i = 0; i < domains.size(); i++) {
-                       out.append("@");
-                       out.append(get(i));
-                       if (i + 1 < domains.size())
-                               out.append(",");
-               }
-               return out.toString();
-       }
+    /**
+     * The number of elements in this list.
+     */
+    public int size() {
+        return domains.size();
+    }
+
+    /**
+     * Gets the domain name or domain literal at the specified index.
+     * 
+     * @throws IndexOutOfBoundsException
+     *             If index is &lt; 0 or &gt;= size().
+     */
+    public String get(int index) {
+        if (0 > index || size() <= index)
+            throw new IndexOutOfBoundsException();
+        return domains.get(index);
+    }
+
+    /**
+     * Returns the list of domains formatted as a route string (not including
+     * the trailing ':').
+     */
+    public String toRouteString() {
+        StringBuilder out = new StringBuilder();
+        for (int i = 0; i < domains.size(); i++) {
+            out.append("@");
+            out.append(get(i));
+            if (i + 1 < domains.size())
+                out.append(",");
+        }
+        return out.toString();
+    }
 }

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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -22,54 +22,54 @@
 import java.util.List;
 
 /**
- * A named group of zero or more mailboxes.  
- *
- * 
+ * A named group of zero or more mailboxes.
  */
 public class Group extends Address {
-       private String name;
-       private MailboxList mailboxList;
-       
-       /**
-        * @param name The group name.
-        * @param mailboxes The mailboxes in this group.
-        */
-       public Group(String name, MailboxList mailboxes) {
-               this.name = name;
-               this.mailboxList = mailboxes;
-       }
-
-       /**
-        * Returns the group name.
-        */
-       public String getName() {
-               return name;
-       }
-       
-       /**
-        * Returns the mailboxes in this group.
-        */
-       public MailboxList getMailboxes() {
-               return mailboxList;
-       }
-       
-       @Override
-       public String toString() {
-               StringBuilder buf = new StringBuilder();
-               buf.append(name);
-               buf.append(":");
-               for (int i = 0; i < mailboxList.size(); i++) {
-                       buf.append(mailboxList.get(i).toString());
-                       if (i + 1 < mailboxList.size())
-                               buf.append(",");
-               }
-               buf.append(";");
-               return buf.toString();
-       }
-
-       @Override
-       protected void doAddMailboxesTo(List<Mailbox> results) {
-               for (int i = 0; i < mailboxList.size(); i++)
-                       results.add(mailboxList.get(i));
-       }
+    private String name;
+    private MailboxList mailboxList;
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public Group(String name, MailboxList mailboxes) {
+        this.name = name;
+        this.mailboxList = mailboxes;
+    }
+
+    /**
+     * Returns the group name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the mailboxes in this group.
+     */
+    public MailboxList getMailboxes() {
+        return mailboxList;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder();
+        buf.append(name);
+        buf.append(":");
+        for (int i = 0; i < mailboxList.size(); i++) {
+            buf.append(mailboxList.get(i).toString());
+            if (i + 1 < mailboxList.size())
+                buf.append(",");
+        }
+        buf.append(";");
+        return buf.toString();
+    }
+
+    @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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -22,100 +22,103 @@
 import java.util.List;
 
 /**
- * Represents a single e-mail address. 
- *
- * 
+ * Represents a single e-mail address.
  */
 public class Mailbox extends Address {
-       private DomainList route;
-       private String localPart;
-       private String domain;
-
-       /**
-        * Creates a mailbox without a route. Routes are obsolete.
-        * @param localPart The part of the e-mail address to the left of the 
"@".
-        * @param domain The part of the e-mail address to the right of the "@".
-        */
-       public Mailbox(String localPart, String domain) {
-               this(null, localPart, domain);
-       }
-       
-       /**
-        * Creates a mailbox with a route. Routes are obsolete.
-        * @param route The zero or more domains that make up the route. Can be 
null.
-        * @param localPart The part of the e-mail address to the left of the 
"@".
-        * @param domain The part of the e-mail address to the right of the "@".
-        */
-       public Mailbox(DomainList route, String localPart, String domain) {
-               this.route = route;
-               this.localPart = localPart;
-               this.domain = domain;
-       }
-
-       /**
-        * Returns the route list.
-        */
-       public DomainList getRoute() {
-               return route;
-       }
-
-       /**
-        * Returns the left part of the e-mail address 
-        * (before "@").
-        */
-       public String getLocalPart() {
-               return localPart;
-       }
-       
-       /**
-        * Returns the right part of the e-mail address 
-        * (after "@").
-        */
-       public String getDomain() {
-               return domain;
-       }
-
-       /**
-        * Formats the address as a string, not including
-        * the route.
-        * 
-        * @see #getAddressString(boolean)
-        */
-       public String getAddressString() {
-               return getAddressString(false);
-       }
-       
-       /**
-        * Note that this value may not be usable
-        * for transport purposes, only display purposes.
-        * 
-        * For example, if the unparsed address was
-        * 
-        *   <"Joe Cheng"@joecheng.com>
-        * 
-        * this method would return
-        * 
-        *   <Joe [email protected]>
-        * 
-        * which is not valid for transport; the local part
-        * would need to be re-quoted.
-        * 
-        * @param includeRoute true if the route should be included if it 
exists. 
-        */
-       public String getAddressString(boolean includeRoute) {
-               return "<" + (!includeRoute || route == null ? "" : 
route.toRouteString() + ":") 
-                       + localPart
-                       + (domain == null ? "" : "@") 
-                       + domain + ">";  
-       }
-       
-       @Override
-       protected final void doAddMailboxesTo(List<Mailbox> results) {
-               results.add(this);
-       }
-       
-       @Override
-       public String toString() {
-               return getAddressString();
-       }
+    private DomainList route;
+    private String localPart;
+    private String domain;
+
+    /**
+     * Creates a mailbox without a route. Routes are obsolete.
+     * 
+     * @param localPart
+     *            The part of the e-mail address to the left of the "@".
+     * @param domain
+     *            The part of the e-mail address to the right of the "@".
+     */
+    public Mailbox(String localPart, String domain) {
+        this(null, localPart, domain);
+    }
+
+    /**
+     * Creates a mailbox with a route. Routes are obsolete.
+     * 
+     * @param route
+     *            The zero or more domains that make up the route. Can be null.
+     * @param localPart
+     *            The part of the e-mail address to the left of the "@".
+     * @param domain
+     *            The part of the e-mail address to the right of the "@".
+     */
+    public Mailbox(DomainList route, String localPart, String domain) {
+        this.route = route;
+        this.localPart = localPart;
+        this.domain = domain;
+    }
+
+    /**
+     * Returns the route list.
+     */
+    public DomainList getRoute() {
+        return route;
+    }
+
+    /**
+     * Returns the left part of the e-mail address (before "@").
+     */
+    public String getLocalPart() {
+        return localPart;
+    }
+
+    /**
+     * Returns the right part of the e-mail address (after "@").
+     */
+    public String getDomain() {
+        return domain;
+    }
+
+    /**
+     * Formats the address as a string, not including the route.
+     * 
+     * @see #getAddressString(boolean)
+     */
+    public String getAddressString() {
+        return getAddressString(false);
+    }
+
+    /**
+     * Note that this value may not be usable for transport purposes, only
+     * display purposes.
+     * 
+     * For example, if the unparsed address was
+     * 
+     * <"Joe Cheng"@joecheng.com>
+     * 
+     * this method would return
+     * 
+     * <Joe [email protected]>
+     * 
+     * which is not valid for transport; the local part would need to be
+     * re-quoted.
+     * 
+     * @param includeRoute
+     *            true if the route should be included if it exists.
+     */
+    public String getAddressString(boolean includeRoute) {
+        return "<"
+                + (!includeRoute || route == null ? "" : route.toRouteString()
+                        + ":") + localPart + (domain == null ? "" : "@")
+                + domain + ">";
+    }
+
+    @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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -24,49 +24,51 @@
 
 /**
  * An immutable, random-access list of Mailbox objects.
- *
- * 
  */
 public class MailboxList {
 
-       private List<Mailbox> mailboxes;
-       
-       /**
-        * @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(List<Mailbox> mailboxes, boolean dontCopy) {
-               if (mailboxes != null)
-                       this.mailboxes = dontCopy ? mailboxes : new 
ArrayList<Mailbox>(mailboxes);
-               else
-                       this.mailboxes = new ArrayList<Mailbox>(0);
-       }
-       
-       /**
-        * The number of elements in this list.
-        */
-       public int size() {
-               return mailboxes.size();
-       }
-       
-       /**
-        * Gets an address. 
-        */
-       public Mailbox get(int index) {
-               if (0 > index || size() <= index)
-                       throw new IndexOutOfBoundsException();
-               return mailboxes.get(index);
-       }
-       
-       /**
-        * Dumps a representation of this mailbox list to
-        * stdout, for debugging purposes.
-        */
-       public void print() {
-               for (int i = 0; i < size(); i++) {
-                       Mailbox mailbox = get(i);
-                       System.out.println(mailbox.toString());
-               }
-       }
+    private List<Mailbox> mailboxes;
+
+    /**
+     * @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(List<Mailbox> mailboxes, boolean dontCopy) {
+        if (mailboxes != null)
+            this.mailboxes = dontCopy ? mailboxes : new ArrayList<Mailbox>(
+                    mailboxes);
+        else
+            this.mailboxes = new ArrayList<Mailbox>(0);
+    }
+
+    /**
+     * The number of elements in this list.
+     */
+    public int size() {
+        return mailboxes.size();
+    }
+
+    /**
+     * Gets an address.
+     */
+    public Mailbox get(int index) {
+        if (0 > index || size() <= index)
+            throw new IndexOutOfBoundsException();
+        return mailboxes.get(index);
+    }
+
+    /**
+     * Dumps a representation of this mailbox list to stdout, for debugging
+     * purposes.
+     */
+    public void print() {
+        for (int i = 0; i < size(); i++) {
+            Mailbox mailbox = get(i);
+            System.out.println(mailbox.toString());
+        }
+    }
 
 }

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=730402&r1=730401&r2=730402&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
 Wed Dec 31 06:18:53 2008
@@ -21,51 +21,52 @@
 
 /**
  * A Mailbox that has a name/description.
- *
- * 
  */
 public class NamedMailbox extends Mailbox {
-       private String name;
+    private String name;
 
-       /**
-        * @see Mailbox#Mailbox(String, String)
-        */
-       public NamedMailbox(String name, String localPart, String domain) {
-               super(localPart, domain);
-               this.name = name;
-       }
-
-       /**
-        * @see Mailbox#Mailbox(DomainList, String, String)
-        */
-       public NamedMailbox(String name, DomainList route, String localPart, 
String domain) {
-               super(route, localPart, domain);
-               this.name = name;
-       }
-       
-       /**
-        * Creates a named mailbox based on an unnamed mailbox. 
-        */
-       public NamedMailbox(String name, Mailbox baseMailbox) {
-               super(baseMailbox.getRoute(), baseMailbox.getLocalPart(), 
baseMailbox.getDomain());
-               this.name = name;
-       }
-
-       /**
-        * Returns the name of the mailbox. 
-        */
-       public String getName() {
-               return this.name;
-       }
-       
-       /**
-        * Same features (or problems) as Mailbox.getAddressString(boolean),
-        * only more so.
-        * 
-        * @see Mailbox#getAddressString(boolean) 
-        */
-       @Override
-       public String getAddressString(boolean includeRoute) {
-               return (name == null ? "" : name + " ") + 
super.getAddressString(includeRoute);
-       }
+    /**
+     * @see Mailbox#Mailbox(String, String)
+     */
+    public NamedMailbox(String name, String localPart, String domain) {
+        super(localPart, domain);
+        this.name = name;
+    }
+
+    /**
+     * @see Mailbox#Mailbox(DomainList, String, String)
+     */
+    public NamedMailbox(String name, DomainList route, String localPart,
+            String domain) {
+        super(route, localPart, domain);
+        this.name = name;
+    }
+
+    /**
+     * Creates a named mailbox based on an unnamed mailbox.
+     */
+    public NamedMailbox(String name, Mailbox baseMailbox) {
+        super(baseMailbox.getRoute(), baseMailbox.getLocalPart(), baseMailbox
+                .getDomain());
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of the mailbox.
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * Same features (or problems) as Mailbox.getAddressString(boolean), only
+     * more so.
+     * 
+     * @see Mailbox#getAddressString(boolean)
+     */
+    @Override
+    public String getAddressString(boolean includeRoute) {
+        return (name == null ? "" : name + " ")
+                + super.getAddressString(includeRoute);
+    }
 }

Modified: 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
URL: 
http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/HeaderTest.java?rev=730402&r1=730401&r2=730402&view=diff
==============================================================================
--- 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
 (original)
+++ 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
 Wed Dec 31 06:18:53 2008
@@ -101,7 +101,7 @@
         String s = buffer.toString(MessageUtils.ISO_8859_1.name());
         
         assertEquals("Hello: " + hello + "\r\n" +
-                       "Content-type: text/plain; charset=ISO-8859-1\r\n\r\n", 
s);
+                "Content-type: text/plain; charset=ISO-8859-1\r\n\r\n", s);
     }
     
     public void testRemoveFields() throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to