mirror of https://github.com/apache/activemq.git
AMQ-4012: Use english locale when doing lower/upper case introspection to avoid issues when running on certain locales such as turkish.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1379765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e724cd53f
commit
4b44d3129c
|
@ -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 Service {
|
|||
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) {
|
||||
|
|
|
@ -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 EmptyBroker {
|
|||
public String getBrokerName() {
|
||||
if (brokerName == null) {
|
||||
try {
|
||||
brokerName = InetAddressUtil.getLocalHostName().toLowerCase();
|
||||
brokerName = InetAddressUtil.getLocalHostName().toLowerCase(Locale.ENGLISH);
|
||||
} catch (Exception e) {
|
||||
brokerName = "localhost";
|
||||
}
|
||||
|
|
|
@ -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 extends DataSourceSupport implements Persist
|
|||
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);
|
||||
|
|
|
@ -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 LegacyFrameTranslator implements
|
|||
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 LegacyFrameTranslator implements
|
|||
|
||||
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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.transport.stomp;
|
|||
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 Command {
|
|||
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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue