elasticsearch-grails-plugin icon indicating copy to clipboard operation
elasticsearch-grails-plugin copied to clipboard

Error : Unparseable date: "date.struct" with Grails POST/save request

Open spolom opened this issue 10 years ago • 1 comments

Hi,

the plugin's JSONDateBinder hooked in via CustomEditorRegistrar tries to parse Date values from domain classes and fails to do so:

Even though that the domain class in question is not marked as searchable and a simple controller/service not related to the plugin is being used to save a domain instance, JSONDateBinder.setAsText is being run.

Grails (default) behaviour is to split a Date in a POST/save request to for example:

dueDate:date.struct dueDate_day:19 dueDate_month:12 dueDate_year:2014

The plugin will try to parse the string "date.struct" as a Date and fail, leaving the value of dueDate equaling to null - which in our case prevents us from saving the instance as the field is not nullable.

Best, Szymon

Grails: 2.3.9 Plugin versions: 0.0.3.7, 0.0.3.8

Log from plugin:

Date date.struct did not match any of the pattern registered! You may want to add the pattern to the [elasticSearch.date.formats] setting. Error : Unparseable date: "date.struct"

spolom avatar Dec 19 '14 13:12 spolom

I suppose that both the CustomerEditorRegistrar and JSONDateBinder are old artefacts that can be just deleted as the marshalling/demarshalling is being handled elsewhere.

Am I correct on this?

spolom avatar Dec 19 '14 14:12 spolom