cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jji...@apache.org
Subject [3/6] cassandra git commit: Explicitly set locale for string validation
Date Thu, 20 Oct 2016 04:04:25 GMT
Explicitly set locale for string validation

Patch by Amit Deshpande; Reviewed by Jeff Jirsa for CASSANDRA-12541,CASSANDRA-12542,CASSANDRA-12543,CASSANDRA-12545


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c9ca441b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c9ca441b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c9ca441b

Branch: refs/heads/trunk
Commit: c9ca441bde92f7497e85eba2f69e2b70dc9bcf25
Parents: 55568c1
Author: Amit Deshpande <Amit.Deshpande@capitalone.com>
Authored: Wed Oct 19 15:16:54 2016 -0500
Committer: Jeff Jirsa <jeff.jirsa@crowdstrike.com>
Committed: Wed Oct 19 20:54:08 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                     | 1 +
 src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java  | 2 +-
 src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java | 5 +++--
 src/java/org/apache/cassandra/thrift/ThriftConversion.java      | 4 ++--
 src/java/org/apache/cassandra/utils/CoalescingStrategies.java   | 3 ++-
 5 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ca441b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 31e96b9..749a3b0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,7 @@
  * Backport CASSANDRA-10756 (race condition in NativeTransportService shutdown) (CASSANDRA-12472)
  * If CF has no clustering columns, any row cache is full partition cache (CASSANDRA-12499)
  * Correct log message for statistics of offheap memtable flush (CASSANDRA-12776)
+ * Explicitly set locale for string validation (CASSANDRA-12541,CASSANDRA-12542,CASSANDRA-12543,CASSANDRA-12545)
 Merged from 2.2:
  * Clean up permissions when a UDA is dropped (CASSANDRA-12720)
  * Limit colUpdateTimeDelta histogram updates to reasonable deltas (CASSANDRA-11117)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ca441b/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java b/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
index cdd93a9..d2a0d86 100644
--- a/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
+++ b/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
@@ -125,7 +125,7 @@ class CqlRecordWriter extends RecordWriter<Map<String, ByteBuffer>,
List<ByteBuf
             partitionKeyColumns = tableMetadata.getPartitionKey();
 
             String cqlQuery = CqlConfigHelper.getOutputCql(conf).trim();
-            if (cqlQuery.toLowerCase().startsWith("insert"))
+            if (cqlQuery.toLowerCase(Locale.ENGLISH).startsWith("insert"))
                 throw new UnsupportedOperationException("INSERT with CqlRecordWriter is not
supported, please use UPDATE/DELETE statement");
             cql = appendKeyWhereClauses(cqlQuery);
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ca441b/src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java b/src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java
index 58c6375..43447f0 100644
--- a/src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java
+++ b/src/java/org/apache/cassandra/schema/SpeculativeRetryParam.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.schema;
 
 import java.text.DecimalFormat;
 import java.util.concurrent.TimeUnit;
+import java.util.Locale;
 
 import com.google.common.base.Objects;
 
@@ -88,7 +89,7 @@ public final class SpeculativeRetryParam
 
     public static SpeculativeRetryParam fromString(String value)
     {
-        if (value.toLowerCase().endsWith("ms"))
+        if (value.toLowerCase(Locale.ENGLISH).endsWith("ms"))
         {
             try
             {
@@ -100,7 +101,7 @@ public final class SpeculativeRetryParam
             }
         }
 
-        if (value.toUpperCase().endsWith(Kind.PERCENTILE.toString()))
+        if (value.toUpperCase(Locale.ENGLISH).endsWith(Kind.PERCENTILE.toString()))
         {
             double threshold;
             try

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ca441b/src/java/org/apache/cassandra/thrift/ThriftConversion.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/ThriftConversion.java b/src/java/org/apache/cassandra/thrift/ThriftConversion.java
index 3443b6e..bccfd8a 100644
--- a/src/java/org/apache/cassandra/thrift/ThriftConversion.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftConversion.java
@@ -194,7 +194,7 @@ public class ThriftConversion
     private static boolean isSuper(String thriftColumnType)
     throws org.apache.cassandra.exceptions.InvalidRequestException
     {
-        switch (thriftColumnType.toLowerCase())
+        switch (thriftColumnType.toLowerCase(Locale.ENGLISH))
         {
             case "standard": return false;
             case "super": return true;
@@ -676,7 +676,7 @@ public class ThriftConversion
 
     private static CachingParams cachingFromTrhfit(String caching)
     {
-        switch (caching.toUpperCase())
+        switch (caching.toUpperCase(Locale.ENGLISH))
         {
             case "ALL":
                 return CachingParams.CACHE_EVERYTHING;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ca441b/src/java/org/apache/cassandra/utils/CoalescingStrategies.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/CoalescingStrategies.java b/src/java/org/apache/cassandra/utils/CoalescingStrategies.java
index 7dba97b..486e3f1 100644
--- a/src/java/org/apache/cassandra/utils/CoalescingStrategies.java
+++ b/src/java/org/apache/cassandra/utils/CoalescingStrategies.java
@@ -32,6 +32,7 @@ import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.LockSupport;
+import java.util.Locale;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
@@ -499,7 +500,7 @@ public class CoalescingStrategies
                                                     String displayName)
     {
         String classname = null;
-        String strategyCleaned = strategy.trim().toUpperCase();
+        String strategyCleaned = strategy.trim().toUpperCase(Locale.ENGLISH);
         switch(strategyCleaned)
         {
         case "MOVINGAVERAGE":


Mime
View raw message