You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pg...@apache.org on 2002/08/08 01:25:12 UTC

cvs commit: jakarta-james/src/java/org/apache/james/transport/matchers HostIs.java HostIsLocal.java RecipientIsLocal.java SizeGreaterThan.java

pgoldstein    2002/08/07 16:25:12

  Modified:    src/java/org/apache/james/transport/matchers HostIs.java
                        HostIsLocal.java RecipientIsLocal.java
                        SizeGreaterThan.java
  Log:
  Part of the String=>StringBuffer changes.  Includes some additional
  commenting, formatting fixes, and wrapping of logging calls in log
  level checks.  Also converted equalsIgnoreCase paradigm as discussed on
  mailing list.  Locale issue for both toUpperCase() and toLowerCase() was
  addressed as well.
  
  Revision  Changes    Path
  1.3       +3 -2      jakarta-james/src/java/org/apache/james/transport/matchers/HostIs.java
  
  Index: HostIs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/HostIs.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HostIs.java	18 Jan 2002 02:48:38 -0000	1.2
  +++ HostIs.java	7 Aug 2002 23:25:12 -0000	1.3
  @@ -11,6 +11,7 @@
   import org.apache.mailet.MailAddress;
   
   import java.util.Collection;
  +import java.util.Locale;
   import java.util.StringTokenizer;
   import java.util.Vector;
   
  @@ -26,11 +27,11 @@
           StringTokenizer st = new StringTokenizer(getCondition(), ", ", false);
           hosts = new Vector();
           while (st.hasMoreTokens()) {
  -            hosts.add(st.nextToken().toLowerCase());
  +            hosts.add(st.nextToken().toLowerCase(Locale.US));
           }
       }
   
       public boolean matchRecipient(MailAddress recipient) {
  -        return hosts.contains(recipient.getHost().toLowerCase());
  +        return hosts.contains(recipient.getHost().toLowerCase(Locale.US));
       }
   }
  
  
  
  1.3       +2 -1      jakarta-james/src/java/org/apache/james/transport/matchers/HostIsLocal.java
  
  Index: HostIsLocal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/HostIsLocal.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HostIsLocal.java	18 Jan 2002 02:48:38 -0000	1.2
  +++ HostIsLocal.java	7 Aug 2002 23:25:12 -0000	1.3
  @@ -9,6 +9,7 @@
   
   import org.apache.mailet.GenericRecipientMatcher;
   import org.apache.mailet.MailAddress;
  +import java.util.Locale;
   
   /**
    * @version 1.0.0, 24/04/1999
  @@ -18,6 +19,6 @@
   public class HostIsLocal extends GenericRecipientMatcher {
   
       public boolean matchRecipient(MailAddress recipient) {
  -        return getMailetContext().isLocalServer(recipient.getHost().toLowerCase());
  +        return getMailetContext().isLocalServer(recipient.getHost().toLowerCase(Locale.US));
       }
   }
  
  
  
  1.3       +2 -1      jakarta-james/src/java/org/apache/james/transport/matchers/RecipientIsLocal.java
  
  Index: RecipientIsLocal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/RecipientIsLocal.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RecipientIsLocal.java	18 Jan 2002 02:48:38 -0000	1.2
  +++ RecipientIsLocal.java	7 Aug 2002 23:25:12 -0000	1.3
  @@ -10,6 +10,7 @@
   import org.apache.mailet.GenericRecipientMatcher;
   import org.apache.mailet.MailAddress;
   import org.apache.mailet.MailetContext;
  +import java.util.Locale;
   
   /**
    * @version 1.0.0, 24/04/1999
  @@ -21,7 +22,7 @@
       public boolean matchRecipient(MailAddress recipient) {
           MailetContext mailetContext = getMailetContext();
           //This might change after startup
  -        return mailetContext.isLocalServer(recipient.getHost().toLowerCase())
  +        return mailetContext.isLocalServer(recipient.getHost().toLowerCase(Locale.US))
               && mailetContext.isLocalUser(recipient.getUser());
       }
   }
  
  
  
  1.4       +2 -1      jakarta-james/src/java/org/apache/james/transport/matchers/SizeGreaterThan.java
  
  Index: SizeGreaterThan.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/SizeGreaterThan.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SizeGreaterThan.java	18 Jan 2002 02:48:38 -0000	1.3
  +++ SizeGreaterThan.java	7 Aug 2002 23:25:12 -0000	1.4
  @@ -15,6 +15,7 @@
   import javax.mail.internet.MimeMessage;
   import java.util.Collection;
   import java.util.Enumeration;
  +import java.util.Locale;
   
   /**
    * Checks whether the message (entire message, not just content) is greater
  @@ -29,7 +30,7 @@
       int cutoff = 0;
   
       public void init() {
  -        String amount = getCondition().trim().toLowerCase();
  +        String amount = getCondition().trim().toLowerCase(Locale.US);
           if (amount.endsWith("k")) {
               amount = amount.substring(0, amount.length() - 1);
               cutoff = Integer.parseInt(amount) * 1024;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>