geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: rev 54262 - in geronimo/trunk/specs/javamail/src/java/javax/mail: . internet
Date Sun, 10 Oct 2004 19:17:58 GMT
Author: jboynes
Date: Sun Oct 10 12:17:57 2004
New Revision: 54262

Modified:
   geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java
   geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java
Log:
fix api signature

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java	Sun Oct 10 12:17:57 2004
@@ -21,9 +21,7 @@
  * @version $Rev$ $Date$
  */
 public abstract class Address implements Serializable {
-    public boolean equals(Object object) {
-        return (object != null && object.getClass() == this.getClass());
-    }
+    public abstract boolean equals(Object object);
     public abstract String getType();
     public abstract String toString();
 }

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java	Sun Oct 10 12:17:57
2004
@@ -36,17 +36,8 @@
             }
             _header = header;
         }
-        public boolean equals(Object other) {
-            if (other == null || other.getClass() != this.getClass()) {
-                return false;
-            }
-            return ((Item) other)._header.equals(_header);
-        }
         String getHeader() {
             return _header;
-        }
-        public int hashCode() {
-            return _header.hashCode();
         }
     }
     private static final String[] headersType = new String[0];

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java	Sun Oct 10 12:17:57 2004
@@ -46,23 +46,9 @@
             _name = name;
             _system = system;
         }
-        public boolean equals(Object other) {
-            if (other == null || other.getClass() != this.getClass()) {
-                return false;
-            }
-            Flag flag = (Flag) other;
-            return (
-                flag.getName() == null
-                    && this.getName() == null
-                    || flag.getName() != null
-                    && flag.getName().equals(this.getName()));
-        }
         private String getName() {
             return _name;
         }
-        public int hashCode() {
-            return getName().hashCode();
-        }
         private boolean isSystemFlag() {
             return _system;
         }
@@ -90,11 +76,15 @@
     public void add(String name) {
         add(new Flag(name));
     }
-    public Object clone() throws CloneNotSupportedException {
-        Flags clone = (Flags) super.clone();
-        // do a deep clone of user_flags
-        clone._map = new HashMap(_map);
-        return clone;
+    public Object clone() {
+        try {
+            Flags clone = (Flags) super.clone();
+            // do a deep clone of user_flags
+            clone._map = new HashMap(_map);
+            return clone;
+        } catch (CloneNotSupportedException e) {
+            throw new AssertionError();
+        }
     }
     public boolean contains(Flag flag) {
         return _map.containsKey(flag.getName());

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java	Sun Oct 10 12:17:57 2004
@@ -39,9 +39,6 @@
         private Type(String name) {
             _name = name;
         }
-        public String toString() {
-            return _name;
-        }
         static Type getType(String name) {
             if (name.equals("store")) {
                 return STORE;

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java	Sun Oct 10 12:17:57 2004
@@ -20,7 +20,7 @@
  * @version $Rev$ $Date$
  */
 public interface UIDFolder {
-    public static final long LASTUID = -11;
+    public static final long LASTUID = -1;
     public abstract long getUIDValidity() throws MessagingException;
     public abstract Message getMessageByUID(long uid)
         throws MessagingException;

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java	Sun Oct
10 12:17:57 2004
@@ -38,30 +38,12 @@
         public String getValue() {
             return _value;
         }
-        public String toString() {
-            String type = "Unknown";
-            switch (_type) {
-                case ATOM :
-                    type = "Atom";
-                    break;
-                case COMMENT :
-                    type = "Comment";
-                    break;
-                case EOF :
-                    type = "EOF";
-                    break;
-                case QUOTEDSTRING :
-                    type = "String";
-                    break;
-            }
-            return "[" + type + "] \"" + getValue() + "\"";
-        }
     }
     private static final Token EOF = new Token(Token.EOF, null);
     // characters not allowed in MIME
-    public static final String MIME = "[]()<>@.:,;\\\" \t?=";
+    public static final String MIME = "()<>@,;:\\\"\t []/?=";
     // charaters not allowed in RFC822
-    public static final String RFC822 = "[]()<>@.:,;\\\" \t";
+    public static final String RFC822 = "()<>@,;:\\\"\t .[]";
     private static final String WHITE = " \t\n\r";
     private String _delimiters;
     private String _header;

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java	Sun Oct
10 12:17:57 2004
@@ -141,11 +141,6 @@
         ia.encodedPersonal = encodedPersonal;
         return ia;
     }
-    public boolean equals(Object other) {
-        return super.equals(other)
-            && ((InternetAddress) other).personal.equals(personal)
-            && ((InternetAddress) other).address.equals(address);
-    }
     public String getAddress() {
         return address;
     }
@@ -159,10 +154,6 @@
     public String getType() {
         return "rfc822";
     }
-    public int hashCode() {
-        // hash of the name and address
-        return personal.hashCode() + address.hashCode();
-    }
     public boolean isGroup() {
         // TODO Not implemented
         return false;
@@ -190,5 +181,24 @@
     }
     public void validate() throws AddressException {
         // TODO Not implemented
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof InternetAddress)) return false;
+
+        final InternetAddress internetAddress = (InternetAddress) o;
+
+        if (!address.equals(internetAddress.address)) return false;
+        if (!personal.equals(internetAddress.personal)) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = address.hashCode();
+        result = 29 * result + personal.hashCode();
+        return result;
     }
 }

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java	Sun Oct 10
12:17:57 2004
@@ -40,7 +40,7 @@
     public static class RecipientType extends Message.RecipientType {
         public static final RecipientType NEWSGROUPS =
             new RecipientType("Newsgroups");
-        private RecipientType(String type) {
+        protected RecipientType(String type) {
             super(type);
         }
         protected Object readResolve() throws ObjectStreamException {
@@ -118,7 +118,7 @@
         // TODO Implement method
         throw new UnsupportedOperationException("Method not yet implemented");
     }
-    public Object getContent() throws IOException {
+    public Object getContent() throws MessagingException, IOException {
         // TODO Implement method
         throw new UnsupportedOperationException("Method not yet implemented");
     }
@@ -180,7 +180,7 @@
         // TODO Implement method
         throw new UnsupportedOperationException("Method not yet implemented");
     }
-    public InputStream getInputStream() throws IOException {
+    public InputStream getInputStream() throws MessagingException, IOException {
         // TODO Implement method
         throw new UnsupportedOperationException("Method not yet implemented");
     }
@@ -349,11 +349,10 @@
     }
     protected void updateHeaders() throws MessagingException {
     }
-    public void writeTo(OutputStream out) throws IOException {
+    public void writeTo(OutputStream out) throws MessagingException, IOException {
     }
-    public void writeTo(OutputStream out, String[] ignoreHeaders)
-        throws IOException {
+    public void writeTo(OutputStream out, String[] ignoreHeaders) throws MessagingException,
IOException {
     }
-    public void setSender(Address address) {
+    public void setSender(Address address) throws MessagingException {
     }
 }

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java	Sun Oct 10
12:17:57 2004
@@ -28,6 +28,9 @@
  * @version $Rev$ $Date$
  */
 public class MimeUtility {
+    private MimeUtility(){
+    }
+
     // From J2SE 1.4 API Docs (Constant Values)
     public static final int ALL = -1;
     public static InputStream decode(InputStream in, String encoding)

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java	(original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java	Sun Oct 10
12:17:57 2004
@@ -58,17 +58,6 @@
         setNewsgroup(newsgroup);
         setHost(host);
     }
-    public boolean equals(Object other) {
-        if (other == null || other.getClass() != this.getClass()) {
-            return false;
-        }
-        NewsAddress address = (NewsAddress) other;
-        return (
-            address.host == host || host != null && host.equals(address.host))
-            && (address.newsgroup == newsgroup
-                || newsgroup != null
-                && newsgroup.equals(address.newsgroup));
-    }
     public String getHost() {
         return host;
     }
@@ -78,9 +67,6 @@
     public String getType() {
         return "news";
     }
-    public int hashCode() {
-        return toString().hashCode();
-    }
     public void setHost(String string) {
         host = string;
     }
@@ -96,5 +82,24 @@
     }
     public String toString() {
         return newsgroup + (host == null ? "" : "@" + host);
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof NewsAddress)) return false;
+
+        final NewsAddress newsAddress = (NewsAddress) o;
+
+        if (!host.equals(newsAddress.host)) return false;
+        if (!newsgroup.equals(newsAddress.newsgroup)) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = host.hashCode();
+        result = 29 * result + newsgroup.hashCode();
+        return result;
     }
 }

Mime
View raw message