Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/428#discussion_r207622324
  
    --- Diff: 
solr/core/src/java/org/apache/solr/update/processor/ParseDateFieldUpdateProcessorFactory.java
 ---
    @@ -144,15 +149,17 @@ public void init(NamedList args) {
         }
     
         Object defaultTimeZoneParam = args.remove(DEFAULT_TIME_ZONE_PARAM);
    -    DateTimeZone defaultTimeZone = DateTimeZone.UTC;
    +    ZoneId defaultTimeZone = ZoneOffset.UTC;
         if (null != defaultTimeZoneParam) {
    -      defaultTimeZone = 
DateTimeZone.forID(defaultTimeZoneParam.toString());
    +      defaultTimeZone = ZoneId.of(defaultTimeZoneParam.toString());
         }
     
         Collection<String> formatsParam = args.removeConfigArgs(FORMATS_PARAM);
         if (null != formatsParam) {
           for (String value : formatsParam) {
    -        formats.put(value, 
DateTimeFormat.forPattern(value).withZone(defaultTimeZone).withLocale(locale));
    +        DateTimeFormatter formatter = new 
DateTimeFormatterBuilder().parseCaseInsensitive()
    +            
.appendPattern(value).toFormatter(locale).withZone(defaultTimeZone);
    +        formats.put(value, formatter);
    --- End diff --
    
    Please add a round-trip check so we can see if parseInstant will handle the 
format.  I think I had this in my other patch; you can see there.  This way if 
someone puts in an invalid pattern (i.e. something silly like only the month), 
they get notified up front that the format is invalid.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to