This is an automated email from the ASF dual-hosted git repository.
leventov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new 48bc523 Locale problem is fixed which fails tests. (#7120)
48bc523 is described below
commit 48bc523bdf36201263517cc431340fd4960e6ea3
Author: Furkan KAMACI <[email protected]>
AuthorDate: Thu Mar 14 00:47:14 2019 +0300
Locale problem is fixed which fails tests. (#7120)
* Locale problem is fixed which fails tests.
* Forbidden apis definition is improved to prevent using
com.ibm.icu.text.SimpleDateFormat and com.ibm.icu.text.DateFormatSymbols
without using any Locale defined.
* Error message is improved.
---
codestyle/druid-forbidden-apis.txt | 5 +++++
.../java/org/apache/druid/query/extraction/TimeDimExtractionFn.java | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/codestyle/druid-forbidden-apis.txt
b/codestyle/druid-forbidden-apis.txt
index 5eb5256..3d7da96 100644
--- a/codestyle/druid-forbidden-apis.txt
+++ b/codestyle/druid-forbidden-apis.txt
@@ -35,6 +35,11 @@ java.lang.Math#random() @ Use ThreadLocalRandom.current()
java.util.regex.Pattern#matches(java.lang.String,java.lang.CharSequence) @ Use
String.startsWith(), endsWith(), contains(), or compile and cache a Pattern
explicitly
org.apache.commons.io.FileUtils#getTempDirectory() @ Use
org.junit.rules.TemporaryFolder for tests instead
+@defaultMessage Use Locale.ENGLISH
+com.ibm.icu.text.DateFormatSymbols#<init>()
+com.ibm.icu.text.SimpleDateFormat#<init>()
+com.ibm.icu.text.SimpleDateFormat#<init>(java.lang.String)
+
@defaultMessage For performance reasons, use the utf8Base64 / encodeBase64 /
encodeBase64String / decodeBase64 / decodeBase64String methods in StringUtils
org.apache.commons.codec.binary.Base64
com.google.common.io.BaseEncoding.base64
\ No newline at end of file
diff --git
a/processing/src/main/java/org/apache/druid/query/extraction/TimeDimExtractionFn.java
b/processing/src/main/java/org/apache/druid/query/extraction/TimeDimExtractionFn.java
index 8b58a81..1e82b3e 100644
---
a/processing/src/main/java/org/apache/druid/query/extraction/TimeDimExtractionFn.java
+++
b/processing/src/main/java/org/apache/druid/query/extraction/TimeDimExtractionFn.java
@@ -33,6 +33,7 @@ import javax.annotation.Nullable;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.util.Date;
+import java.util.Locale;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -84,8 +85,8 @@ public class TimeDimExtractionFn extends DimExtractionFn
} else {
final ThreadLocal<Function<String, String>> threadLocal =
ThreadLocal.withInitial(
() -> {
- final SimpleDateFormat parser = new SimpleDateFormat(timeFormat);
- final SimpleDateFormat formatter = new
SimpleDateFormat(resultFormat);
+ final SimpleDateFormat parser = new SimpleDateFormat(timeFormat,
Locale.ENGLISH);
+ final SimpleDateFormat formatter = new
SimpleDateFormat(resultFormat, Locale.ENGLISH);
parser.setLenient(true);
return value -> {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]