-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite Loop in DefaultToSoyDataConverter when model contains BindingResult #60
Comments
I am aware of this, this is why I have this https://github.com/matiwinnetou/spring-soy-view/blob/master/spring-soy-view/src/main/java/pl/matisoft/soy/data/adjust/ModelAdjuster.java, this basically allows to filter out the model passed to DefaultToSoyDataConverter class. |
How do I fix that? It worked with POJOs, but since I'm using Spring Data JPA, it stackoverflows:
|
Spring can add a BindingResult object into the model for objects in the model that are not primitive or collections. Unfortunately if this happens, DefaultToSoyDataConverter blows the stack. When DefaultToSoyDataConverter creates a pojo map from the BindingResult objects, it adds an entry with the key 'model', and a value of the entire model which essentially starts the whole recursive stack over again. It eventually works its way through the model until it gets to the BindingResult again, infinite loop...
Here is a simple test case that reproduces this error. (I put it into pl.matisoft.soy.data.DefaultToSoyDataConverterTest)
Running the above test produced the following results :
I am not sure about the best way to deal with this. We could add explicit code to deal with BindingResults, but I am not sure that is the best solution...
The text was updated successfully, but these errors were encountered: