activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1379765 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/ broker/region/ store/jdbc/ transport/stomp/ util/
Date Sat, 01 Sep 2012 14:50:34 GMT
Author: davsclaus
Date: Sat Sep  1 14:50:33 2012
New Revision: 1379765

URL: http://svn.apache.org/viewvc?rev=1379765&view=rev
Log:
AMQ-4012: Use english locale when doing lower/upper case introspection to avoid issues when
running on certain locales such as turkish.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/JmsFrameTranslator.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/GenerateJDBCStatements.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Sat Sep  1 14:50:33 2012
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -1222,7 +1223,7 @@ public class BrokerService implements Se
                 if (uri != null) {
                     String scheme = uri.getScheme();
                     if (scheme != null) {
-                        answer.put(scheme.toLowerCase(), uri.toString());
+                        answer.put(scheme.toLowerCase(Locale.ENGLISH), uri.toString());
                     }
                 }
             } catch (Exception e) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Sat Sep  1 14:50:33 2012
@@ -48,6 +48,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -600,7 +601,7 @@ public class RegionBroker extends EmptyB
     public String getBrokerName() {
         if (brokerName == null) {
             try {
-                brokerName = InetAddressUtil.getLocalHostName().toLowerCase();
+                brokerName = InetAddressUtil.getLocalHostName().toLowerCase(Locale.ENGLISH);
             } catch (Exception e) {
                 brokerName = "localhost";
             }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Sat Sep  1 14:50:33 2012
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Set;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -478,7 +479,7 @@ public class JDBCPersistenceAdapter exte
             try {
                 // Make the filename file system safe.
                 String dirverName = c.getConnection().getMetaData().getDriverName();
-                dirverName = dirverName.replaceAll("[^a-zA-Z0-9\\-]", "_").toLowerCase();
+                dirverName = dirverName.replaceAll("[^a-zA-Z0-9\\-]", "_").toLowerCase(Locale.ENGLISH);
 
                 try {
                     adapter = finder.newInstance(dirverName);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/JmsFrameTranslator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/JmsFrameTranslator.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/JmsFrameTranslator.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/JmsFrameTranslator.java
Sat Sep  1 14:50:33 2012
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.jms.JMSException;
@@ -171,7 +172,7 @@ public class JmsFrameTranslator extends 
             throws JMSException {
         StringWriter buffer = new StringWriter();
         HierarchicalStreamWriter out;
-        if (transformation.toLowerCase().endsWith("json")) {
+        if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
             out = new JettisonMappedXmlDriver(new Configuration(), false).createWriter(buffer);
         } else {
             out = new PrettyPrintWriter(buffer);
@@ -201,7 +202,7 @@ public class JmsFrameTranslator extends 
 
         StringWriter buffer = new StringWriter();
         HierarchicalStreamWriter out;
-        if (transformation.toLowerCase().endsWith("json")) {
+        if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
             out = new JettisonMappedXmlDriver().createWriter(buffer);
         } else {
             out = new PrettyPrintWriter(buffer);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
Sat Sep  1 14:50:33 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.transport.stomp;
 
+import java.util.Locale;
+
 public interface Stomp {
     String NULL = "\u0000";
     String NEWLINE = "\n";
@@ -172,11 +174,11 @@ public interface Stomp {
         JMS_ADVISORY_JSON;
 
         public String toString() {
-            return name().replaceAll("_", "-").toLowerCase();
+            return name().replaceAll("_", "-").toLowerCase(Locale.ENGLISH);
         }
 
         public static Transformations getValue(String value) {
-            return valueOf(value.replaceAll("-", "_").toUpperCase());
+            return valueOf(value.replaceAll("-", "_").toUpperCase(Locale.ENGLISH));
         }
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
Sat Sep  1 14:50:33 2012
@@ -19,6 +19,7 @@ package org.apache.activemq.transport.st
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.activemq.command.Command;
@@ -186,7 +187,7 @@ public class StompFrame implements Comma
         for (Map.Entry<String, String> entry : headers.entrySet()) {
             buffer.append(entry.getKey());
             buffer.append(":");
-            if (forLogging && entry.getKey().toString().toLowerCase().contains(Stomp.Headers.Connect.PASSCODE))
{
+            if (forLogging && entry.getKey().toString().toLowerCase(Locale.ENGLISH).contains(Stomp.Headers.Connect.PASSCODE))
{
                 buffer.append("*****");
             } else {
                 buffer.append(entry.getValue());

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/GenerateJDBCStatements.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/GenerateJDBCStatements.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/GenerateJDBCStatements.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/GenerateJDBCStatements.java
Sat Sep  1 14:50:33 2012
@@ -17,6 +17,7 @@
 package org.apache.activemq.util;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.regex.Pattern;
 
 import org.apache.activemq.store.jdbc.Statements;
@@ -55,14 +56,14 @@ public class GenerateJDBCStatements {
     	}
     	for(int i=0; i<methods.length;i++){
     		if(sPattern.matcher(methods[i].getName()).find()&&setMethods.contains(methods[i].getName().replace("get","set"))){
-    			System.out.println("<property name=\""+methods[i].getName().substring(3,4).toLowerCase()+methods[i].getName().substring(4)+"\"
value=\""+returnStatement(methods[i].invoke(s, (Object[])null))+"\" />");
+    			System.out.println("<property name=\""+methods[i].getName().substring(3,4).toLowerCase(Locale.ENGLISH)+methods[i].getName().substring(4)+"\"
value=\""+returnStatement(methods[i].invoke(s, (Object[])null))+"\" />");
     		}
     	}
     	//for a typo is not needed if removeMessageStatment typo is corrected
     	Pattern sPattern2= Pattern.compile("get.*Statment$");
     	for(int i=0; i<methods.length;i++){
     		if(sPattern2.matcher(methods[i].getName()).find()){
-    			System.out.println("<property name=\""+methods[i].getName().substring(3,4).toLowerCase()+methods[i].getName().substring(4)+"\"
value=\""+returnStatement(methods[i].invoke(s, (Object[])null))+"\" />");
+    			System.out.println("<property name=\""+methods[i].getName().substring(3,4).toLowerCase(Locale.ENGLISH)+methods[i].getName().substring(4)+"\"
value=\""+returnStatement(methods[i].invoke(s, (Object[])null))+"\" />");
     		}
     	}
     	//end of generating because of typo

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?rev=1379765&r1=1379764&r2=1379765&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
Sat Sep  1 14:50:33 2012
@@ -26,6 +26,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Map.Entry;
@@ -101,10 +102,10 @@ public final class IntrospectionSupport 
                         continue;
                     }
                     if (name.startsWith("get")) {
-                        name = name.substring(3, 4).toLowerCase()
+                        name = name.substring(3, 4).toLowerCase(Locale.ENGLISH)
                                 + name.substring(4);
                     } else {
-                        name = name.substring(2, 3).toLowerCase()
+                        name = name.substring(2, 3).toLowerCase(Locale.ENGLISH)
                                 + name.substring(3);
                     }
                     props.put(optionPrefix + name, strValue);
@@ -293,7 +294,7 @@ public final class IntrospectionSupport 
         if (value instanceof ActiveMQDestination) {
             ActiveMQDestination destination = (ActiveMQDestination)value;
             buffer.append(destination.getQualifiedName());
-        } else if (key.toString().toLowerCase().contains("password")){
+        } else if (key.toString().toLowerCase(Locale.ENGLISH).contains("password")){
             buffer.append("*****");           
         } else {
             buffer.append(value);



Mime
View raw message