james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r778457 [4/13] - in /james/mime4j/trunk: benchmark/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/codec/ core/src/main/java/org/apache/james/mime4j/descriptor/ c...
Date Mon, 25 May 2009 17:20:52 GMT
Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java Mon May 25 17:20:48 2009
@@ -1,58 +1,58 @@
-/****************************************************************
- * 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.field;
-
-import org.apache.james.mime4j.codec.DecoderUtil;
-import org.apache.james.mime4j.util.ByteSequence;
-
-/**
- * Simple unstructured field such as <code>Subject</code>.
- */
-public class UnstructuredField extends AbstractField {
-    private boolean parsed = false;
-
-    private String value;
-
-    UnstructuredField(String name, String body, ByteSequence raw) {
-        super(name, body, raw);
-    }
-
-    public String getValue() {
-        if (!parsed)
-            parse();
-
-        return value;
-    }
-
-    private void parse() {
-        String body = getBody();
-
-        value = DecoderUtil.decodeEncodedWords(body);
-
-        parsed = true;
-    }
-
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
-                final ByteSequence raw) {
-            return new UnstructuredField(name, body, raw);
-        }
-    };
-}
+/****************************************************************
+ * 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.field;
+
+import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.mime4j.util.ByteSequence;
+
+/**
+ * Simple unstructured field such as <code>Subject</code>.
+ */
+public class UnstructuredField extends AbstractField {
+    private boolean parsed = false;
+
+    private String value;
+
+    UnstructuredField(String name, String body, ByteSequence raw) {
+        super(name, body, raw);
+    }
+
+    public String getValue() {
+        if (!parsed)
+            parse();
+
+        return value;
+    }
+
+    private void parse() {
+        String body = getBody();
+
+        value = DecoderUtil.decodeEncodedWords(body);
+
+        parsed = true;
+    }
+
+    static final FieldParser PARSER = new FieldParser() {
+        public ParsedField parse(final String name, final String body,
+                final ByteSequence raw) {
+            return new UnstructuredField(name, body, raw);
+        }
+    };
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Address.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Address.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Address.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Address.java Mon May 25 17:20:48 2009
@@ -1,122 +1,122 @@
-/****************************************************************
- * 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.field.address;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.util.List;
-
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
-
-/**
- * The abstract base for classes that represent RFC2822 addresses. This includes
- * groups and mailboxes.
- */
-public abstract class Address implements Serializable {
-
-    private static final long serialVersionUID = 634090661990433426L;
-
-    /**
-     * 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);
-
-    /**
-     * Formats the address as a human readable string, not including the route.
-     * The resulting string is intended for display purposes only and cannot be
-     * used for transport purposes.
-     * 
-     * @return a string representation of this address intended to be displayed
-     * @see #getDisplayString(boolean)
-     */
-    public final String getDisplayString() {
-        return getDisplayString(false);
-    }
-
-    /**
-     * Formats the address as a human readable string, not including the route.
-     * The resulting string is intended for display purposes only and cannot be
-     * used for transport purposes.
-     * 
-     * For example, if the unparsed address was
-     * 
-     * <"Joe Cheng"@joecheng.com>
-     * 
-     * this method would return
-     * 
-     * <Joe Cheng@joecheng.com>
-     * 
-     * which is not valid for transport; the local part would need to be
-     * re-quoted.
-     * 
-     * @param includeRoute
-     *            <code>true</code> if the route should be included if it
-     *            exists, <code>false</code> otherwise.
-     * @return a string representation of this address intended to be displayed.
-     */
-    public abstract String getDisplayString(boolean includeRoute);
-
-    /**
-     * Returns a string representation of this address that can be used for
-     * transport purposes. The route is never included in this representation
-     * because routes are obsolete and RFC 5322 states that obsolete syntactic
-     * forms MUST NOT be generated.
-     * 
-     * @return a string representation of this address intended for transport
-     *         purposes.
-     */
-    public abstract String getEncodedString();
-
-    /**
-     * Parses the specified raw string into an address.
-     * 
-     * @param rawAddressString
-     *            string to parse.
-     * @return an <code>Address</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single address.
-     */
-    public static Address parse(String rawAddressString) {
-        AddressListParser parser = new AddressListParser(new StringReader(
-                rawAddressString));
-        try {
-            return Builder.getInstance().buildAddress(parser.parseAddress());
-        } catch (ParseException e) {
-            throw new IllegalArgumentException(e);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return getDisplayString(false);
-    }
-
+/****************************************************************
+ * 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.field.address;
+
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.List;
+
+import org.apache.james.mime4j.field.address.parser.AddressListParser;
+import org.apache.james.mime4j.field.address.parser.ParseException;
+
+/**
+ * The abstract base for classes that represent RFC2822 addresses. This includes
+ * groups and mailboxes.
+ */
+public abstract class Address implements Serializable {
+
+    private static final long serialVersionUID = 634090661990433426L;
+
+    /**
+     * 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);
+
+    /**
+     * Formats the address as a human readable string, not including the route.
+     * The resulting string is intended for display purposes only and cannot be
+     * used for transport purposes.
+     * 
+     * @return a string representation of this address intended to be displayed
+     * @see #getDisplayString(boolean)
+     */
+    public final String getDisplayString() {
+        return getDisplayString(false);
+    }
+
+    /**
+     * Formats the address as a human readable string, not including the route.
+     * The resulting string is intended for display purposes only and cannot be
+     * used for transport purposes.
+     * 
+     * For example, if the unparsed address was
+     * 
+     * <"Joe Cheng"@joecheng.com>
+     * 
+     * this method would return
+     * 
+     * <Joe Cheng@joecheng.com>
+     * 
+     * which is not valid for transport; the local part would need to be
+     * re-quoted.
+     * 
+     * @param includeRoute
+     *            <code>true</code> if the route should be included if it
+     *            exists, <code>false</code> otherwise.
+     * @return a string representation of this address intended to be displayed.
+     */
+    public abstract String getDisplayString(boolean includeRoute);
+
+    /**
+     * Returns a string representation of this address that can be used for
+     * transport purposes. The route is never included in this representation
+     * because routes are obsolete and RFC 5322 states that obsolete syntactic
+     * forms MUST NOT be generated.
+     * 
+     * @return a string representation of this address intended for transport
+     *         purposes.
+     */
+    public abstract String getEncodedString();
+
+    /**
+     * Parses the specified raw string into an address.
+     * 
+     * @param rawAddressString
+     *            string to parse.
+     * @return an <code>Address</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single address.
+     */
+    public static Address parse(String rawAddressString) {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawAddressString));
+        try {
+            return Builder.getInstance().buildAddress(parser.parseAddress());
+        } catch (ParseException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return getDisplayString(false);
+    }
+
 }
\ No newline at end of file

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Address.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java Mon May 25 17:20:48 2009
@@ -1,148 +1,148 @@
-/****************************************************************
- * 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.field.address;
-
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
-
-import java.io.Serializable;
-import java.io.StringReader;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * An immutable, random-access list of Address objects.
- */
-public class AddressList extends AbstractList<Address> implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private final List<? extends Address> addresses;
-
-    /**
-     * @param addresses
-     *            A List that contains only Address objects.
-     * @param dontCopy
-     *            true iff it is not possible for the addresses list 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 = Collections.emptyList();
-    }
-
-    /**
-     * The number of elements in this list.
-     */
-    @Override
-    public int size() {
-        return addresses.size();
-    }
-
-    /**
-     * Gets an address.
-     */
-    @Override
-    public Address get(int index) {
-        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.parseAddressList());
-    }
-
-    /**
-     * 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);
-            }
-        }
-    }
-}
+/****************************************************************
+ * 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.field.address;
+
+import org.apache.james.mime4j.field.address.parser.AddressListParser;
+import org.apache.james.mime4j.field.address.parser.ParseException;
+
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An immutable, random-access list of Address objects.
+ */
+public class AddressList extends AbstractList<Address> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private final List<? extends Address> addresses;
+
+    /**
+     * @param addresses
+     *            A List that contains only Address objects.
+     * @param dontCopy
+     *            true iff it is not possible for the addresses list 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 = Collections.emptyList();
+    }
+
+    /**
+     * The number of elements in this list.
+     */
+    @Override
+    public int size() {
+        return addresses.size();
+    }
+
+    /**
+     * Gets an address.
+     */
+    @Override
+    public Address get(int index) {
+        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.parseAddressList());
+    }
+
+    /**
+     * 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);
+            }
+        }
+    }
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java Mon May 25 17:20:48 2009
@@ -1,224 +1,224 @@
-/****************************************************************
- * 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.field.address;
-
-import org.apache.james.mime4j.codec.DecoderUtil;
-import org.apache.james.mime4j.field.address.parser.ASTaddr_spec;
-import org.apache.james.mime4j.field.address.parser.ASTaddress;
-import org.apache.james.mime4j.field.address.parser.ASTaddress_list;
-import org.apache.james.mime4j.field.address.parser.ASTangle_addr;
-import org.apache.james.mime4j.field.address.parser.ASTdomain;
-import org.apache.james.mime4j.field.address.parser.ASTgroup_body;
-import org.apache.james.mime4j.field.address.parser.ASTlocal_part;
-import org.apache.james.mime4j.field.address.parser.ASTmailbox;
-import org.apache.james.mime4j.field.address.parser.ASTname_addr;
-import org.apache.james.mime4j.field.address.parser.ASTphrase;
-import org.apache.james.mime4j.field.address.parser.ASTroute;
-import org.apache.james.mime4j.field.address.parser.Node;
-import org.apache.james.mime4j.field.address.parser.SimpleNode;
-import org.apache.james.mime4j.field.address.parser.Token;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * 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);
-    }
-
-    public 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 Mailbox(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);
-    }
-
-    public 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 Mailbox 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 Mailbox(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++);
-        }
-
-    }
-}
+/****************************************************************
+ * 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.field.address;
+
+import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.mime4j.field.address.parser.ASTaddr_spec;
+import org.apache.james.mime4j.field.address.parser.ASTaddress;
+import org.apache.james.mime4j.field.address.parser.ASTaddress_list;
+import org.apache.james.mime4j.field.address.parser.ASTangle_addr;
+import org.apache.james.mime4j.field.address.parser.ASTdomain;
+import org.apache.james.mime4j.field.address.parser.ASTgroup_body;
+import org.apache.james.mime4j.field.address.parser.ASTlocal_part;
+import org.apache.james.mime4j.field.address.parser.ASTmailbox;
+import org.apache.james.mime4j.field.address.parser.ASTname_addr;
+import org.apache.james.mime4j.field.address.parser.ASTphrase;
+import org.apache.james.mime4j.field.address.parser.ASTroute;
+import org.apache.james.mime4j.field.address.parser.Node;
+import org.apache.james.mime4j.field.address.parser.SimpleNode;
+import org.apache.james.mime4j.field.address.parser.Token;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * 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);
+    }
+
+    public 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 Mailbox(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);
+    }
+
+    public 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 Mailbox 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 Mailbox(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++);
+        }
+
+    }
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/DomainList.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/DomainList.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/DomainList.java Mon May 25 17:20:48 2009
@@ -1,95 +1,95 @@
-/****************************************************************
- * 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.field.address;
-
-import java.io.Serializable;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * An immutable, random-access list of Strings (that are supposedly domain names
- * or domain literals).
- */
-public class DomainList extends AbstractList<String> implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private final List<String> domains;
-
-    /**
-     * @param domains
-     *            A List that contains only String objects.
-     * @param dontCopy
-     *            true iff it is not possible for the domains list 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 = Collections.emptyList();
-    }
-
-    /**
-     * The number of elements in this list.
-     */
-    @Override
-    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().
-     */
-    @Override
-    public String get(int index) {
-        return domains.get(index);
-    }
-
-    /**
-     * Returns the list of domains formatted as a route string (not including
-     * the trailing ':').
-     */
-    public String toRouteString() {
-        StringBuilder sb = new StringBuilder();
-
-        for (String domain : domains) {
-            if (sb.length() > 0) {
-                sb.append(',');
-            }
-
-            sb.append("@");
-            sb.append(domain);
-        }
-
-        return sb.toString();
-    }
-
-    @Override
-    public String toString() {
-        return toRouteString();
-    }
-
-}
+/****************************************************************
+ * 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.field.address;
+
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An immutable, random-access list of Strings (that are supposedly domain names
+ * or domain literals).
+ */
+public class DomainList extends AbstractList<String> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private final List<String> domains;
+
+    /**
+     * @param domains
+     *            A List that contains only String objects.
+     * @param dontCopy
+     *            true iff it is not possible for the domains list 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 = Collections.emptyList();
+    }
+
+    /**
+     * The number of elements in this list.
+     */
+    @Override
+    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().
+     */
+    @Override
+    public String get(int index) {
+        return domains.get(index);
+    }
+
+    /**
+     * Returns the list of domains formatted as a route string (not including
+     * the trailing ':').
+     */
+    public String toRouteString() {
+        StringBuilder sb = new StringBuilder();
+
+        for (String domain : domains) {
+            if (sb.length() > 0) {
+                sb.append(',');
+            }
+
+            sb.append("@");
+            sb.append(domain);
+        }
+
+        return sb.toString();
+    }
+
+    @Override
+    public String toString() {
+        return toRouteString();
+    }
+
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Group.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Group.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Group.java Mon May 25 17:20:48 2009
@@ -1,161 +1,161 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mime4j.field.address;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.james.mime4j.codec.EncoderUtil;
-
-/**
- * A named group of zero or more mailboxes.
- */
-public class Group extends Address {
-
-    private static final long serialVersionUID = 1L;
-
-    private final String name;
-    private final MailboxList mailboxList;
-
-    /**
-     * @param name
-     *            The group name.
-     * @param mailboxes
-     *            The mailboxes in this group.
-     */
-    public Group(String name, Mailbox... mailboxes) {
-        this(name, new MailboxList(Arrays.asList(mailboxes), true));
-    }
-
-    /**
-     * @param name
-     *            The group name.
-     * @param mailboxes
-     *            The mailboxes in this group.
-     */
-    public Group(String name, Collection<Mailbox> mailboxes) {
-        this(name, new MailboxList(new ArrayList<Mailbox>(mailboxes), true));
-    }
-
-    /**
-     * @param name
-     *            The group name.
-     * @param mailboxes
-     *            The mailboxes in this group.
-     */
-    public Group(String name, MailboxList mailboxes) {
-        if (name == null)
-            throw new IllegalArgumentException();
-        if (mailboxes == null)
-            throw new IllegalArgumentException();
-
-        this.name = name;
-        this.mailboxList = mailboxes;
-    }
-
-    /**
-     * Parses the specified raw string into a group address.
-     * 
-     * @param rawGroupString
-     *            string to parse.
-     * @return a <code>Group</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single group address.
-     */
-    public static Group parse(String rawGroupString) {
-        Address address = Address.parse(rawGroupString);
-        if (!(address instanceof Group))
-            throw new IllegalArgumentException("Not a group address");
-
-        return (Group) address;
-    }
-
-    /**
-     * Returns the group name.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the mailboxes in this group.
-     */
-    public MailboxList getMailboxes() {
-        return mailboxList;
-    }
-
-    @Override
-    public String getDisplayString(boolean includeRoute) {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append(name);
-        sb.append(':');
-
-        boolean first = true;
-        for (Mailbox mailbox : mailboxList) {
-            if (first) {
-                first = false;
-            } else {
-                sb.append(',');
-            }
-
-            sb.append(' ');
-            sb.append(mailbox.getDisplayString(includeRoute));
-        }
-
-        sb.append(";");
-
-        return sb.toString();
-    }
-
-    @Override
-    public String getEncodedString() {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append(EncoderUtil.encodeAddressDisplayName(name));
-        sb.append(':');
-
-        boolean first = true;
-        for (Mailbox mailbox : mailboxList) {
-            if (first) {
-                first = false;
-            } else {
-                sb.append(',');
-            }
-
-            sb.append(' ');
-            sb.append(mailbox.getEncodedString());
-        }
-
-        sb.append(';');
-
-        return sb.toString();
-    }
-
-    @Override
-    protected void doAddMailboxesTo(List<Mailbox> results) {
-        for (Mailbox mailbox : mailboxList) {
-            results.add(mailbox);
-        }
-    }
-
-}
+/****************************************************************
+ * 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.field.address;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.james.mime4j.codec.EncoderUtil;
+
+/**
+ * A named group of zero or more mailboxes.
+ */
+public class Group extends Address {
+
+    private static final long serialVersionUID = 1L;
+
+    private final String name;
+    private final MailboxList mailboxList;
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public Group(String name, Mailbox... mailboxes) {
+        this(name, new MailboxList(Arrays.asList(mailboxes), true));
+    }
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public Group(String name, Collection<Mailbox> mailboxes) {
+        this(name, new MailboxList(new ArrayList<Mailbox>(mailboxes), true));
+    }
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public Group(String name, MailboxList mailboxes) {
+        if (name == null)
+            throw new IllegalArgumentException();
+        if (mailboxes == null)
+            throw new IllegalArgumentException();
+
+        this.name = name;
+        this.mailboxList = mailboxes;
+    }
+
+    /**
+     * Parses the specified raw string into a group address.
+     * 
+     * @param rawGroupString
+     *            string to parse.
+     * @return a <code>Group</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single group address.
+     */
+    public static Group parse(String rawGroupString) {
+        Address address = Address.parse(rawGroupString);
+        if (!(address instanceof Group))
+            throw new IllegalArgumentException("Not a group address");
+
+        return (Group) address;
+    }
+
+    /**
+     * Returns the group name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the mailboxes in this group.
+     */
+    public MailboxList getMailboxes() {
+        return mailboxList;
+    }
+
+    @Override
+    public String getDisplayString(boolean includeRoute) {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(name);
+        sb.append(':');
+
+        boolean first = true;
+        for (Mailbox mailbox : mailboxList) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(',');
+            }
+
+            sb.append(' ');
+            sb.append(mailbox.getDisplayString(includeRoute));
+        }
+
+        sb.append(";");
+
+        return sb.toString();
+    }
+
+    @Override
+    public String getEncodedString() {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(EncoderUtil.encodeAddressDisplayName(name));
+        sb.append(':');
+
+        boolean first = true;
+        for (Mailbox mailbox : mailboxList) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(',');
+            }
+
+            sb.append(' ');
+            sb.append(mailbox.getEncodedString());
+        }
+
+        sb.append(';');
+
+        return sb.toString();
+    }
+
+    @Override
+    protected void doAddMailboxesTo(List<Mailbox> results) {
+        for (Mailbox mailbox : mailboxList) {
+            results.add(mailbox);
+        }
+    }
+
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java Mon May 25 17:20:48 2009
@@ -1,288 +1,288 @@
-/****************************************************************
- * 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.field.address;
-
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.james.mime4j.codec.EncoderUtil;
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
-
-/**
- * Represents a single e-mail address.
- */
-public class Mailbox extends Address {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final DomainList EMPTY_ROUTE_LIST = new DomainList(
-            Collections.<String> emptyList(), true);
-
-    private final String name;
-    private final DomainList route;
-    private final String localPart;
-    private final String domain;
-
-    /**
-     * Creates an unnamed 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, null, localPart, domain);
-    }
-
-    /**
-     * Creates an unnamed mailbox with a route. Routes are obsolete.
-     * 
-     * @param route
-     *            The zero or more domains that make up the route. May be
-     *            <code>null</code>.
-     * @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(null, route, localPart, domain);
-    }
-
-    /**
-     * Creates a named mailbox without a route. Routes are obsolete.
-     * 
-     * @param name
-     *            the name of the e-mail address. May be <code>null</code>.
-     * @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 name, String localPart, String domain) {
-        this(name, null, localPart, domain);
-    }
-
-    /**
-     * Creates a named mailbox with a route. Routes are obsolete.
-     * 
-     * @param name
-     *            the name of the e-mail address. May be <code>null</code>.
-     * @param route
-     *            The zero or more domains that make up the route. May be
-     *            <code>null</code>.
-     * @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 name, DomainList route, String localPart,
-            String domain) {
-        if (localPart == null || localPart.length() == 0)
-            throw new IllegalArgumentException();
-
-        this.name = name == null || name.length() == 0 ? null : name;
-        this.route = route == null ? EMPTY_ROUTE_LIST : route;
-        this.localPart = localPart;
-        this.domain = domain == null || domain.length() == 0 ? null : domain;
-    }
-
-    /**
-     * Creates a named mailbox based on an unnamed mailbox. Package private;
-     * internally used by Builder.
-     */
-    Mailbox(String name, Mailbox baseMailbox) {
-        this(name, baseMailbox.getRoute(), baseMailbox.getLocalPart(),
-                baseMailbox.getDomain());
-    }
-
-    /**
-     * Parses the specified raw string into a mailbox address.
-     * 
-     * @param rawMailboxString
-     *            string to parse.
-     * @return a <code>Mailbox</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single mailbox
-     *             address.
-     */
-    public static Mailbox parse(String rawMailboxString) {
-        AddressListParser parser = new AddressListParser(new StringReader(
-                rawMailboxString));
-        try {
-            return Builder.getInstance().buildMailbox(parser.parseMailbox());
-        } catch (ParseException e) {
-            throw new IllegalArgumentException(e);
-        }
-    }
-
-    /**
-     * Returns the name of the mailbox or <code>null</code> if it does not
-     * have a name.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the route list. If the mailbox does not have a route an empty
-     * domain list is returned.
-     */
-    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;
-    }
-
-    /**
-     * Returns the address in the form <i>localPart@domain</i>.
-     * 
-     * @return the address part of this mailbox.
-     */
-    public String getAddress() {
-        if (domain == null) {
-            return localPart;
-        } else {
-            return localPart + '@' + domain;
-        }
-    }
-
-    @Override
-    public String getDisplayString(boolean includeRoute) {
-        includeRoute &= route != null;
-        boolean includeAngleBrackets = name != null || includeRoute;
-
-        StringBuilder sb = new StringBuilder();
-
-        if (name != null) {
-            sb.append(name);
-            sb.append(' ');
-        }
-
-        if (includeAngleBrackets) {
-            sb.append('<');
-        }
-
-        if (includeRoute) {
-            sb.append(route.toRouteString());
-            sb.append(':');
-        }
-
-        sb.append(localPart);
-
-        if (domain != null) {
-            sb.append('@');
-            sb.append(domain);
-        }
-
-        if (includeAngleBrackets) {
-            sb.append('>');
-        }
-
-        return sb.toString();
-    }
-
-    @Override
-    public String getEncodedString() {
-        StringBuilder sb = new StringBuilder();
-
-        if (name != null) {
-            sb.append(EncoderUtil.encodeAddressDisplayName(name));
-            sb.append(" <");
-        }
-
-        sb.append(EncoderUtil.encodeAddressLocalPart(localPart));
-
-        // domain = dot-atom / domain-literal
-        // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]
-        // dtext = %d33-90 / %d94-126
-        if (domain != null) {
-            sb.append('@');
-            sb.append(domain);
-        }
-
-        if (name != null) {
-            sb.append('>');
-        }
-
-        return sb.toString();
-    }
-
-    @Override
-    public int hashCode() {
-        return getCanonicalizedAddress().hashCode();
-    }
-
-    /**
-     * Indicates whether some other object is "equal to" this mailbox.
-     * <p>
-     * An object is considered to be equal to this mailbox if it is an instance
-     * of class <code>Mailbox</code> that holds the same address as this one.
-     * The domain is considered to be case-insensitive but the local-part is not
-     * (because of RFC 5321: <cite>the local-part of a mailbox MUST BE treated
-     * as case sensitive</cite>).
-     * 
-     * @param obj
-     *            the object to test for equality.
-     * @return <code>true</code> if the specified object is a
-     *         <code>Mailbox</code> that holds the same address as this one.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-        if (!(obj instanceof Mailbox))
-            return false;
-
-        Mailbox other = (Mailbox) obj;
-        return getCanonicalizedAddress()
-                .equals(other.getCanonicalizedAddress());
-    }
-
-    @Override
-    protected final void doAddMailboxesTo(List<Mailbox> results) {
-        results.add(this);
-    }
-
-    private Object getCanonicalizedAddress() {
-        if (domain == null) {
-            return localPart;
-        } else {
-            return localPart + '@' + domain.toLowerCase(Locale.US);
-        }
-    }
-
-}
+/****************************************************************
+ * 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.field.address;
+
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.james.mime4j.codec.EncoderUtil;
+import org.apache.james.mime4j.field.address.parser.AddressListParser;
+import org.apache.james.mime4j.field.address.parser.ParseException;
+
+/**
+ * Represents a single e-mail address.
+ */
+public class Mailbox extends Address {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final DomainList EMPTY_ROUTE_LIST = new DomainList(
+            Collections.<String> emptyList(), true);
+
+    private final String name;
+    private final DomainList route;
+    private final String localPart;
+    private final String domain;
+
+    /**
+     * Creates an unnamed 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, null, localPart, domain);
+    }
+
+    /**
+     * Creates an unnamed mailbox with a route. Routes are obsolete.
+     * 
+     * @param route
+     *            The zero or more domains that make up the route. May be
+     *            <code>null</code>.
+     * @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(null, route, localPart, domain);
+    }
+
+    /**
+     * Creates a named mailbox without a route. Routes are obsolete.
+     * 
+     * @param name
+     *            the name of the e-mail address. May be <code>null</code>.
+     * @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 name, String localPart, String domain) {
+        this(name, null, localPart, domain);
+    }
+
+    /**
+     * Creates a named mailbox with a route. Routes are obsolete.
+     * 
+     * @param name
+     *            the name of the e-mail address. May be <code>null</code>.
+     * @param route
+     *            The zero or more domains that make up the route. May be
+     *            <code>null</code>.
+     * @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 name, DomainList route, String localPart,
+            String domain) {
+        if (localPart == null || localPart.length() == 0)
+            throw new IllegalArgumentException();
+
+        this.name = name == null || name.length() == 0 ? null : name;
+        this.route = route == null ? EMPTY_ROUTE_LIST : route;
+        this.localPart = localPart;
+        this.domain = domain == null || domain.length() == 0 ? null : domain;
+    }
+
+    /**
+     * Creates a named mailbox based on an unnamed mailbox. Package private;
+     * internally used by Builder.
+     */
+    Mailbox(String name, Mailbox baseMailbox) {
+        this(name, baseMailbox.getRoute(), baseMailbox.getLocalPart(),
+                baseMailbox.getDomain());
+    }
+
+    /**
+     * Parses the specified raw string into a mailbox address.
+     * 
+     * @param rawMailboxString
+     *            string to parse.
+     * @return a <code>Mailbox</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single mailbox
+     *             address.
+     */
+    public static Mailbox parse(String rawMailboxString) {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawMailboxString));
+        try {
+            return Builder.getInstance().buildMailbox(parser.parseMailbox());
+        } catch (ParseException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    /**
+     * Returns the name of the mailbox or <code>null</code> if it does not
+     * have a name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the route list. If the mailbox does not have a route an empty
+     * domain list is returned.
+     */
+    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;
+    }
+
+    /**
+     * Returns the address in the form <i>localPart@domain</i>.
+     * 
+     * @return the address part of this mailbox.
+     */
+    public String getAddress() {
+        if (domain == null) {
+            return localPart;
+        } else {
+            return localPart + '@' + domain;
+        }
+    }
+
+    @Override
+    public String getDisplayString(boolean includeRoute) {
+        includeRoute &= route != null;
+        boolean includeAngleBrackets = name != null || includeRoute;
+
+        StringBuilder sb = new StringBuilder();
+
+        if (name != null) {
+            sb.append(name);
+            sb.append(' ');
+        }
+
+        if (includeAngleBrackets) {
+            sb.append('<');
+        }
+
+        if (includeRoute) {
+            sb.append(route.toRouteString());
+            sb.append(':');
+        }
+
+        sb.append(localPart);
+
+        if (domain != null) {
+            sb.append('@');
+            sb.append(domain);
+        }
+
+        if (includeAngleBrackets) {
+            sb.append('>');
+        }
+
+        return sb.toString();
+    }
+
+    @Override
+    public String getEncodedString() {
+        StringBuilder sb = new StringBuilder();
+
+        if (name != null) {
+            sb.append(EncoderUtil.encodeAddressDisplayName(name));
+            sb.append(" <");
+        }
+
+        sb.append(EncoderUtil.encodeAddressLocalPart(localPart));
+
+        // domain = dot-atom / domain-literal
+        // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]
+        // dtext = %d33-90 / %d94-126
+        if (domain != null) {
+            sb.append('@');
+            sb.append(domain);
+        }
+
+        if (name != null) {
+            sb.append('>');
+        }
+
+        return sb.toString();
+    }
+
+    @Override
+    public int hashCode() {
+        return getCanonicalizedAddress().hashCode();
+    }
+
+    /**
+     * Indicates whether some other object is "equal to" this mailbox.
+     * <p>
+     * An object is considered to be equal to this mailbox if it is an instance
+     * of class <code>Mailbox</code> that holds the same address as this one.
+     * The domain is considered to be case-insensitive but the local-part is not
+     * (because of RFC 5321: <cite>the local-part of a mailbox MUST BE treated
+     * as case sensitive</cite>).
+     * 
+     * @param obj
+     *            the object to test for equality.
+     * @return <code>true</code> if the specified object is a
+     *         <code>Mailbox</code> that holds the same address as this one.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this)
+            return true;
+        if (!(obj instanceof Mailbox))
+            return false;
+
+        Mailbox other = (Mailbox) obj;
+        return getCanonicalizedAddress()
+                .equals(other.getCanonicalizedAddress());
+    }
+
+    @Override
+    protected final void doAddMailboxesTo(List<Mailbox> results) {
+        results.add(this);
+    }
+
+    private Object getCanonicalizedAddress() {
+        if (domain == null) {
+            return localPart;
+        } else {
+            return localPart + '@' + domain.toLowerCase(Locale.US);
+        }
+    }
+
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java?rev=778457&r1=778456&r2=778457&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java Mon May 25 17:20:48 2009
@@ -1,79 +1,79 @@
-/****************************************************************
- * 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.field.address;
-
-import java.io.Serializable;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * An immutable, random-access list of Mailbox objects.
- */
-public class MailboxList extends AbstractList<Mailbox> implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private final List<Mailbox> mailboxes;
-
-    /**
-     * @param mailboxes
-     *            A List that contains only Mailbox objects.
-     * @param dontCopy
-     *            true iff it is not possible for the mailboxes list 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 = Collections.emptyList();
-    }
-
-    /**
-     * The number of elements in this list.
-     */
-    @Override
-    public int size() {
-        return mailboxes.size();
-    }
-
-    /**
-     * Gets an address.
-     */
-    @Override
-    public Mailbox get(int index) {
-        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());
-        }
-    }
-
-}
+/****************************************************************
+ * 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.field.address;
+
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An immutable, random-access list of Mailbox objects.
+ */
+public class MailboxList extends AbstractList<Mailbox> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private final List<Mailbox> mailboxes;
+
+    /**
+     * @param mailboxes
+     *            A List that contains only Mailbox objects.
+     * @param dontCopy
+     *            true iff it is not possible for the mailboxes list 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 = Collections.emptyList();
+    }
+
+    /**
+     * The number of elements in this list.
+     */
+    @Override
+    public int size() {
+        return mailboxes.size();
+    }
+
+    /**
+     * Gets an address.
+     */
+    @Override
+    public Mailbox get(int index) {
+        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());
+        }
+    }
+
+}

Propchange: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message