Description
groovy.json.internal.Dates#isJsonDate is always returns false for valid JSON date. This causes INDEX_OVERLAY parser to not parse dates even if checkDates was set to true
See the implementation code:
public static boolean isJsonDate(char[] charArray, int start, int to) { boolean valid = true; final int length = to - start; if (length != JSON_TIME_LENGTH) { return false; } valid &= (charArray[start + 19] == '.'); if (!valid) { return false; }
However valid JSON date looks like:
2014-10-21T15:15:56+0000
so there is no dots in this string so this method will always return false. This consequently leads to groovy.json.internal.CharSequenceValue#doToValue returns string instead of date so parser will never actually parse dates properly
Test example:
import groovy.json.* def o = new JsonSlurper(). setType(JsonParserType.INDEX_OVERLAY). setCheckDates(true). parseText(JsonOutput.toJson([a : new Date()])) assertEquals(Date.class, o.a)