mirror of https://github.com/apache/druid.git
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.
This commit is contained in:
parent
fb1489d313
commit
48bc523bdf
|
@ -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
|
|
@ -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 -> {
|
||||
|
|
Loading…
Reference in New Issue