Skip to content

Commit ab35ae3

Browse files
committed
address comment
Signed-off-by: zane-neo <zaniu@amazon.com>
1 parent 85cd1ec commit ab35ae3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/org/opensearch/neuralsearch/util/ProcessorDocumentUtils.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static void validateMapTypeValue(
6666
if (!(fieldMap instanceof Map)) { // source value is map type means configuration has to be map type
6767
throw new IllegalArgumentException(
6868
String.format(
69-
Locale.getDefault(),
69+
Locale.ROOT,
7070
"[%s] configuration doesn't match actual value type, configuration type is: %s, actual value type is: %s",
7171
sourceKey,
7272
fieldMap.getClass().getName(),
@@ -101,9 +101,9 @@ private static void validateMapTypeValue(
101101
allowEmpty
102102
);
103103
} else if (!(nextSourceValue instanceof String)) {
104-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] is neither string nor nested type, cannot process it", key));
104+
throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] is neither string nor nested type, cannot process it", key));
105105
} else if (!allowEmpty && StringUtils.isBlank((String) nextSourceValue)) {
106-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] has empty string value, cannot process it", key));
106+
throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] has empty string value, cannot process it", key));
107107
}
108108
}
109109
});
@@ -126,10 +126,10 @@ private static void validateListTypeValue(
126126
}
127127
for (Object element : sourceValue) {
128128
if (Objects.isNull(element)) {
129-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has null, cannot process it", sourceKey));
129+
throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has null, cannot process it", sourceKey));
130130
}
131131
if (element instanceof List) { // nested list case.
132-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] is nested list type, cannot process it", sourceKey));
132+
throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] is nested list type, cannot process it", sourceKey));
133133
} else if (element instanceof Map) {
134134
validateMapTypeValue(
135135
sourceKey,
@@ -142,9 +142,9 @@ private static void validateListTypeValue(
142142
allowEmpty
143143
);
144144
} else if (!(element instanceof String)) {
145-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has non string value, cannot process it", sourceKey));
145+
throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has non string value, cannot process it", sourceKey));
146146
} else if (!allowEmpty && StringUtils.isBlank(element.toString())) {
147-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "list type field [%s] has empty string, cannot process it", sourceKey));
147+
throw new IllegalArgumentException(String.format(Locale.ROOT, "list type field [%s] has empty string, cannot process it", sourceKey));
148148
}
149149
}
150150
}
@@ -161,7 +161,7 @@ private static void validateDepth(
161161
.orElse(environment.settings());
162162
long maxDepth = MapperService.INDEX_MAPPING_DEPTH_LIMIT_SETTING.get(settings);
163163
if (depth > maxDepth) {
164-
throw new IllegalArgumentException(String.format(Locale.getDefault(), "map type field [%s] reaches max depth limit, cannot process it", sourceKey));
164+
throw new IllegalArgumentException(String.format(Locale.ROOT, "map type field [%s] reaches max depth limit, cannot process it", sourceKey));
165165
}
166166
}
167167
}

0 commit comments

Comments
 (0)