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
fragile handling of json views for enum, and LocaldateTime #10525
Comments
This issue is not very clear and rather confusing because you are reporting multiple issues in a single report. json views 1.1.x doesn't support java 8 date types I'm not convinced the Rating domain class is causing any issues. If you can narrow down the issue with rating, and produce an example that doesn't complicate things with java8 date types, that would make this issue much more easily tackled. Please file a new issue in https://github.com/grails/grails-views that only reports on the enum problem. Thanks |
James, i removed the LocalDateTime - i was focussed on reduced problem set. i have the domain class as shown, when i use `json hal.render(post) it fails as shown. when i remove that and write my own view and convert the enum to string it worked fine as shown. what more do you want to pare back to ? |
Your example project still has the properties in the domain. There are no controllers or views in your example application |
Ok weird – ah been commiting locally, have look now - - just commented out the enum also. But the json hal.render (post) fails – but my had crafted view works and renders
Can you see the rest of the project now ?
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:40
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Your example project still has the properties in the domain. There are no controllers or views in your example application
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfqpQArN0ULH7otSuhgdpKUQsJUCNks5rjr3GgaJpZM4MW1nC> . <https://github.com/notifications/beacon/ABgnfgtg7wyWujUS70pS3Wmkb5mKVkKnks5rjr3GgaJpZM4MW1nC.gif>
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
Just recommitted the whole project back to git hub I hope
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:40
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Your example project still has the properties in the domain. There are no controllers or views in your example application
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfqpQArN0ULH7otSuhgdpKUQsJUCNks5rjr3GgaJpZM4MW1nC> . <https://github.com/notifications/beacon/ABgnfgtg7wyWujUS70pS3Wmkb5mKVkKnks5rjr3GgaJpZM4MW1nC.gif>
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
The _post.gson is calling the json hal.render(post), looks and breaks as shown in stack trace. If I comment that out and use the view by hand beneath my json is rendered
Will
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:40
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Your example project still has the properties in the domain. There are no controllers or views in your example application
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfqpQArN0ULH7otSuhgdpKUQsJUCNks5rjr3GgaJpZM4MW1nC> . <https://github.com/notifications/beacon/ABgnfgtg7wyWujUS70pS3Wmkb5mKVkKnks5rjr3GgaJpZM4MW1nC.gif>
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
Stack dump for me shows this
Caused by: grails.views.ViewRenderException: Error rendering view: null
at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:43)
at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$8.writeTo(DefaultGrailsJsonViewHelper.groovy:790)
at grails.plugin.json.view.JsonViewTemplate.json(JsonViewTemplate.groovy:126)
at grails.plugin.json.view.JsonViewTemplate.json(JsonViewTemplate.groovy:149)
at _info_app_name__postRest_index_gson.run(_info_app_name__postRest_index_gson:12)
at grails.plugin.json.view.JsonViewTemplate.doWrite(JsonViewTemplate.groovy:35)
at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:40)
... 49 common frames omitted
Caused by: java.lang.StackOverflowError: null
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName(Class.java:264)
at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:328)
at grails.plugin.json.builder.JsonOutput.writeIterator(JsonOutput.java:482)
at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:290)
at grails.plugin.json.builder.JsonOutput.writeMap(JsonOutput.java:461)
at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:332)
at grails.plugin.json.builder.JsonOutput.writeIterator(JsonOutput.java:478)
at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:290)
at grails.plugin.json.builder.JsonOutput.writeMap(JsonOutput.java:461)
at grails.plugin.json.builder.JsonOutput.writeObject(JsonOutput.java:332)
at grails.plugin.json.builder.JsonOutput.writeIterator(JsonOutput.java:478)
…..
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:40
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Your example project still has the properties in the domain. There are no controllers or views in your example application
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfqpQArN0ULH7otSuhgdpKUQsJUCNks5rjr3GgaJpZM4MW1nC> .
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
Provide steps to reproduce. http://localhost:8080/api/posts responds with 401 |
Try /api/guest/posts –
I setup an anonymous rest uri as the other is using spring security
Guest version is open
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:52
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Provide steps to reproduce.
http://localhost:8080/api/posts responds with 401
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfiJ0jGRuDpv896xHmpxyYOk7nQrlks5rjsCdgaJpZM4MW1nC> . <https://github.com/notifications/beacon/ABgnfsdzanjVhxkqE1I9U5jAvZq2J4jJks5rjsCdgaJpZM4MW1nC.gif>
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
Did the http://localhost:8080/api/guest/posts work for you this time
From: James Kleeh [mailto:notifications@github.com]
Sent: 08 March 2017 14:52
To: grails/grails-core <grails-core@noreply.github.com>
Cc: woodmawa <will.woodman@btinternet.com>; Author <author@noreply.github.com>
Subject: Re: [grails/grails-core] fragile handling of json views for enum, and LocaldateTime (#10525)
Provide steps to reproduce.
http://localhost:8080/api/posts responds with 401
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#10525 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABgnfiJ0jGRuDpv896xHmpxyYOk7nQrlks5rjsCdgaJpZM4MW1nC> . <https://github.com/notifications/beacon/ABgnfsdzanjVhxkqE1I9U5jAvZq2J4jJks5rjsCdgaJpZM4MW1nC.gif>
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
james - theres a guest |
You're rendering a user object which has a LocalDate. |
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.
Task List
1) install json views plugin and dependencies
2) write restController for a domain object, domain object contains enumType, a map, and ref to user
for a domain class like this
when it runs using the third option i get this which shows that the renderer is doing things, and my own translation of enum to String works as shown
"rating":"5 star"
Expected Behaviour
shouldn't break on standard types such as enum, LocalDateTime etc.
Actual Behaviour
loops and does stackoverflow , Once you get a stacktrace in dev cant seem to edit /fix and restest. have to restart the app to pick up corrections
Environment Information
Example Application
The text was updated successfully, but these errors were encountered: