File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
server/src/main/java/org/elasticsearch/search Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ pr : 132414
2
+ summary : Adjust date docvalue formatting to return 4xx instead of 5xx
3
+ area : Search
4
+ type : bug
5
+ issues : []
Original file line number Diff line number Diff line change 34
34
import java .text .DecimalFormatSymbols ;
35
35
import java .text .NumberFormat ;
36
36
import java .text .ParseException ;
37
+ import java .time .DateTimeException ;
37
38
import java .time .ZoneId ;
38
39
import java .util .Arrays ;
39
40
import java .util .Base64 ;
@@ -304,7 +305,14 @@ public DateMathParser getDateMathParser() {
304
305
305
306
@ Override
306
307
public String format (long value ) {
307
- return formatter .format (resolution .toInstant (value ).atZone (timeZone ));
308
+ try {
309
+ return formatter .format (resolution .toInstant (value ).atZone (timeZone ));
310
+ } catch (DateTimeException dte ) {
311
+ throw new IllegalArgumentException (
312
+ "Failed formatting value [" + value + "] as date with pattern [" + formatter .pattern () + "]" ,
313
+ dte
314
+ );
315
+ }
308
316
}
309
317
310
318
@ Override
You can’t perform that action at this time.
0 commit comments