Author: bago
Date: Mon Aug  8 02:59:57 2005
New Revision: 230781

URL: http://svn.apache.org/viewcvs?rev=230781&view=rev
Log:
added Locale.US to toUpperCase and toLowerCase (JAMES-323)

Modified:
    
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
    
james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
    
james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
    
james/server/trunk/src/java/org/apache/james/transport/matchers/SenderHostIs.java

Modified: 
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java?rev=230781&r1=230780&r2=230781&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
 Mon Aug  8 02:59:57 2005
@@ -68,7 +68,6 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.MessageDigest;
 import java.text.SimpleDateFormat;
-import java.lang.reflect.Array;
 
 /**
  * Implementation of a MailRepository using UNIX mbox files.
@@ -166,7 +165,6 @@
         ByteArrayInputStream mb = new 
ByteArrayInputStream(emailBody.getBytes());
         Properties props = System.getProperties();
         Session session = Session.getDefaultInstance(props);
-        String toAddr = null;
         try {
             mimeMessage = new MimeMessage(session, mb);
 
@@ -184,6 +182,7 @@
         }
 
         /*
+        String toAddr = null;
         try {
             // Attempt to read the TO field and see if it errors
             toAddr = 
mimeMessage.getRecipients(javax.mail.Message.RecipientType.TO).toString();
@@ -218,7 +217,7 @@
         byte[] digArray = 
MessageDigest.getInstance("MD5").digest(emailBody.getBytes());
         StringBuffer digest = new StringBuffer();
         for (int i = 0; i < digArray.length; i++) {
-            digest.append(Integer.toString(digArray[i], 
Character.MAX_RADIX).toUpperCase());
+            digest.append(Integer.toString(digArray[i], 
Character.MAX_RADIX).toUpperCase(Locale.US));
         }
         return digest.toString();
     }
@@ -344,7 +343,6 @@
      */
     private MimeMessage findMessage(String key) {
         MimeMessage foundMessage = null;
-        final String keyValue = key;
 
         // See if we can get the message by using the cache position first
         foundMessage = selectMessage(key);
@@ -822,7 +820,7 @@
         mbx.mboxFile = "C:\\java\\test\\1998-05.txt";
         Iterator mList = mbx.list();
         while (mList.hasNext()) {
-            String key = (String) mList.next();
+            //String key = (String) mList.next();
             //System.out.println("key=" + key);
             /*MailImpl mi =  mbx.retrieve(key);
             try

Modified: 
james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java?rev=230781&r1=230780&r2=230781&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
 Mon Aug  8 02:59:57 2005
@@ -151,7 +151,7 @@
      * @return a [EMAIL PROTECTED] IListServCommand} if found, null otherwise
      */
     public IListServCommand getCommand(String name) {
-        return (IListServCommand) commandMap.get(name.toLowerCase());
+        return (IListServCommand) commandMap.get(name.toLowerCase(Locale.US));
     }
 
     /**

Modified: 
james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=230781&r1=230780&r2=230781&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
 Mon Aug  8 02:59:57 2005
@@ -40,8 +40,6 @@
 import javax.mail.SendFailedException;
 import javax.mail.Session;
 import javax.mail.Transport;
-import javax.mail.URLName;
-import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.ParseException;
@@ -55,7 +53,6 @@
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.james.Constants;
 import org.apache.james.core.MailImpl;
-import org.apache.james.services.MailServer;
 import org.apache.james.services.MailStore;
 import org.apache.james.services.SpoolRepository;
 import org.apache.mailet.MailetContext;
@@ -210,7 +207,6 @@
                                         // parameter is supplied, 
RemoteDeliverySocketFactory
                                         // will be used in this case
     private Collection deliveryThreads = new Vector();
-    private MailServer mailServer;
     private volatile boolean destroyed = false; //Flag that the run method 
will check and end itself if set to true
     private String bounceProcessor = null; // the processor for creating 
Bounces
 
@@ -356,7 +352,7 @@
      */
     private void logSendFailedException(SendFailedException sfe) {
         if (isDebug) {
-            MessagingException me = (MessagingException)sfe;
+            MessagingException me = sfe;
             if (me instanceof SMTPSendFailedException) {
                 SMTPSendFailedException ssfe = (SMTPSendFailedException)me;
                 log("SMTP SEND FAILED:");
@@ -610,7 +606,7 @@
                 deleteMessage = (ssfe.getReturnCode() >= 500 && 
ssfe.getReturnCode() <= 599);
             } else {
                 // Sometimes we'll get a normal SendFailedException with 
nested SMTPAddressFailedException, so use the latter RetCode
-                MessagingException me = (MessagingException)sfe;
+                MessagingException me = sfe;
                 Exception ne;
                 while ((ne = me.getNextException()) != null && ne instanceof 
MessagingException) {
                     me = (MessagingException)ne;
@@ -956,12 +952,12 @@
 
         //Set the hostname we'll use as this server
         if (getMailetContext().getAttribute(Constants.HELLO_NAME) != null) {
-            props.put("mail.smtp.localhost", (String) 
getMailetContext().getAttribute(Constants.HELLO_NAME));
+            props.put("mail.smtp.localhost", 
getMailetContext().getAttribute(Constants.HELLO_NAME));
         }
         else {
             Collection servernames = (Collection) 
getMailetContext().getAttribute(Constants.SERVER_NAMES);
             if ((servernames != null) && (servernames.size() > 0)) {
-                props.put("mail.smtp.localhost", (String) 
servernames.iterator().next());
+                props.put("mail.smtp.localhost", 
servernames.iterator().next());
             }
         }
 
@@ -1103,7 +1099,7 @@
                 
                 if (!res.group(3).equals ("")) {
                     //we have a unit
-                    unit = res.group(3).toLowerCase();
+                    unit = res.group(3).toLowerCase(Locale.US);
                 }
             } else {
                 throw new MessagingException(init_string+" does not match 
"+PATTERN_STRING);

Modified: 
james/server/trunk/src/java/org/apache/james/transport/matchers/SenderHostIs.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/matchers/SenderHostIs.java?rev=230781&r1=230780&r2=230781&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/transport/matchers/SenderHostIs.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/transport/matchers/SenderHostIs.java
 Mon Aug  8 02:59:57 2005
@@ -22,6 +22,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 /**
@@ -51,7 +52,7 @@
         //..into a vector of domain names.
         senderHosts = new java.util.HashSet();
         while (st.hasMoreTokens()) {
-            senderHosts.add(((String)st.nextToken()).toLowerCase());
+            senderHosts.add(st.nextToken().toLowerCase(Locale.US));
         }
         senderHosts = Collections.unmodifiableCollection(senderHosts);
     }
@@ -66,7 +67,7 @@
      */
     public Collection match(Mail mail) {
         try {
-            if (mail.getSender() != null && 
senderHosts.contains(mail.getSender().getHost().toLowerCase())) {
+            if (mail.getSender() != null && 
senderHosts.contains(mail.getSender().getHost().toLowerCase(Locale.US))) {
                 return mail.getRecipients();
             }
         } catch (Exception e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to