From ab35ae3f054b2ada069fb9a7780ea6763a593724 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Wed, 5 Jun 2024 08:00:10 +0800 Subject: [PATCH] address comment Signed-off-by: zane-neo --- .../util/ProcessorDocumentUtils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/opensearch/neuralsearch/util/ProcessorDocumentUtils.java b/src/main/java/org/opensearch/neuralsearch/util/ProcessorDocumentUtils.java index 1e691b3b6..b209dbed7 100644 --- a/src/main/java/org/opensearch/neuralsearch/util/ProcessorDocumentUtils.java +++ b/src/main/java/org/opensearch/neuralsearch/util/ProcessorDocumentUtils.java @@ -66,7 +66,7 @@ private static void validateMapTypeValue( if (!(fieldMap instanceof Map)) { // source value is map type means configuration has to be map type throw new IllegalArgumentException( String.format( - Locale.getDefault(), + Locale.ROOT, "[%s] configuration doesn't match actual value type, configuration type is: %s, actual value type is: %s", sourceKey, fieldMap.getClass().getName(), @@ -101,9 +101,9 @@ private static void validateMapTypeValue( allowEmpty ); } else if (!(nextSourceValue instanceof String)) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] is neither string nor nested type, cannot process it", key)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] is neither string nor nested type, cannot process it", key)); } else if (!allowEmpty && StringUtils.isBlank((String) nextSourceValue)) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] has empty string value, cannot process it", key)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] has empty string value, cannot process it", key)); } } }); @@ -126,10 +126,10 @@ private static void validateListTypeValue( } for (Object element : sourceValue) { if (Objects.isNull(element)) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has null, cannot process it", sourceKey)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has null, cannot process it", sourceKey)); } if (element instanceof List) { // nested list case. - throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] is nested list type, cannot process it", sourceKey)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] is nested list type, cannot process it", sourceKey)); } else if (element instanceof Map) { validateMapTypeValue( sourceKey, @@ -142,9 +142,9 @@ private static void validateListTypeValue( allowEmpty ); } else if (!(element instanceof String)) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has non string value, cannot process it", sourceKey)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has non string value, cannot process it", sourceKey)); } else if (!allowEmpty && StringUtils.isBlank(element.toString())) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has empty string, cannot process it", sourceKey)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has empty string, cannot process it", sourceKey)); } } } @@ -161,7 +161,7 @@ private static void validateDepth( .orElse(environment.settings()); long maxDepth = MapperService.INDEX_MAPPING_DEPTH_LIMIT_SETTING.get(settings); if (depth > maxDepth) { - throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] reaches max depth limit, cannot process it", sourceKey)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] reaches max depth limit, cannot process it", sourceKey)); } } }