Skip to content
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

Grails f:all fails as well as create action fails with embedded Integer field #10494

Closed
4 tasks done
angsuman opened this issue Feb 23, 2017 · 7 comments
Closed
4 tasks done

Comments

@angsuman
Copy link

angsuman commented Feb 23, 2017

Grails f:all fails when there is an embedded object containing an Integer field
For example an embedded Address may contain Zip Code / Pin Code, which are normally captured as Integers for good validation

Task List

  • Steps to reproduce
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded here
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a grails application with: grails create-app test
  2. Add the following files to grails-app/domain/test directory

File: grails-app/domain/test/Customer.groovy

package test
class Customer {
String name
Address address
static embedded=['address']
static constraints = {
}
}

File: grails-app/domain/test/Address.groovy

package test
class Address {
String address
int pin
static constraints = {
}
}

  1. Run generate-all: grails generate-all Customer
  2. Run app: grails run-app
  3. Try to create a new Customer (it should fail)
    If that somehow works then go and edit the same customer. It will fail 100% of the time

Expected Behaviour

It should allow us to create and edit customer.

Actual Behaviour

NO error is shown but the page is not displayed

In certain cases I was able to get over this step by adding a number of fields after address but then when editing it gave the error that it cannot find pinCode.

Individually I added all the fields except pinCode, in which case it gives the error that it cannot find

Stacktrace

2017-02-23 21:34:43.782 ERROR --- [nio-8080-exec-7] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/teacher/edit.gsp:45] Error executing tag <g:form>: [views/teacher/edit.gsp:39] Error executing tag <f:field>: No such property: pinCode for class: com.taragana.Teacher] with root cause

groovy.lang.MissingPropertyException: No such property: pinCode for class: com.taragana.Teacher
at org.grails.datastore.gorm.GormInstanceApi.propertyMissing(GormInstanceApi.groovy:55)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.propertyMissing(GormEntity.groovy:57)
at org.grails.plugins.web.taglib.ValidationTagLib.parseForRejectedValue(ValidationTagLib.groovy:114)
at org.grails.plugins.web.taglib.ValidationTagLib$_closure2.doCall(ValidationTagLib.groovy:100)
at org.grails.taglib.TagOutput.captureTagOutput(TagOutput.java:78)
at org.grails.taglib.TagLibraryMetaUtils$_registerMethodMissingForTags_closure3.doCall(TagLibraryMetaUtils.groovy:58)
at grails.plugin.formfields.FormFieldsTagLib.renderNumericInput(FormFieldsTagLib.groovy:569)
at grails.plugin.formfields.FormFieldsTagLib.renderDefaultInput(FormFieldsTagLib.groovy:497)
at grails.plugin.formfields.FormFieldsTagLib.renderWidget(FormFieldsTagLib.groovy:352)
at grails.plugin.formfields.FormFieldsTagLib$_closure3.doCall(FormFieldsTagLib.groovy:156)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp$_run_closure2$_closure27.doCall(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:95)
at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
at org.grails.plugins.web.taglib.FormTagLib$_closure9.doCall(FormTagLib.groovy:447)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp$_run_closure2.doCall(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:102)
at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
at org.grails.plugins.web.taglib.SitemeshTagLib.captureTagContent(SitemeshTagLib.groovy:48)
at org.grails.plugins.web.taglib.SitemeshTagLib$_closure3.doCall(SitemeshTagLib.groovy:156)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp.run(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:105)
at org.grails.gsp.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:162)
at org.grails.gsp.GroovyPageWritable.writeTo(GroovyPageWritable.java:82)
at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:76)
at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.grails.web.sitemesh.GrailsLayoutView.renderInnerView(GrailsLayoutView.java:150)
at org.grails.web.sitemesh.GrailsLayoutView.obtainContent(GrailsLayoutView.java:128)
at org.grails.web.sitemesh.GrailsLayoutView.renderTemplate(GrailsLayoutView.java:63)
at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

2017-02-23 21:34:48.841 ERROR --- [nio-8080-exec-4] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/teacher/edit.gsp:45] Error executing tag <g:form>: [views/teacher/edit.gsp:39] Error executing tag <f:field>: No such property: pinCode for class: com.taragana.Teacher] with root cause

groovy.lang.MissingPropertyException: No such property: pinCode for class: com.taragana.Teacher
at org.grails.datastore.gorm.GormInstanceApi.propertyMissing(GormInstanceApi.groovy:55)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.propertyMissing(GormEntity.groovy:57)
at org.grails.plugins.web.taglib.ValidationTagLib.parseForRejectedValue(ValidationTagLib.groovy:114)
at org.grails.plugins.web.taglib.ValidationTagLib$_closure2.doCall(ValidationTagLib.groovy:100)
at org.grails.taglib.TagOutput.captureTagOutput(TagOutput.java:78)
at org.grails.taglib.TagLibraryMetaUtils$_registerMethodMissingForTags_closure3.doCall(TagLibraryMetaUtils.groovy:58)
at grails.plugin.formfields.FormFieldsTagLib.renderNumericInput(FormFieldsTagLib.groovy:569)
at grails.plugin.formfields.FormFieldsTagLib.renderDefaultInput(FormFieldsTagLib.groovy:497)
at grails.plugin.formfields.FormFieldsTagLib.renderWidget(FormFieldsTagLib.groovy:352)
at grails.plugin.formfields.FormFieldsTagLib$_closure3.doCall(FormFieldsTagLib.groovy:156)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp$_run_closure2$_closure27.doCall(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:95)
at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
at org.grails.plugins.web.taglib.FormTagLib$_closure9.doCall(FormTagLib.groovy:447)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp$_run_closure2.doCall(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:102)
at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
at org.grails.plugins.web.taglib.SitemeshTagLib.captureTagContent(SitemeshTagLib.groovy:48)
at org.grails.plugins.web.taglib.SitemeshTagLib$_closure3.doCall(SitemeshTagLib.groovy:156)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
at home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp.run(home_angsuman_work_StudentMgmt_grails_app_views_teacher_edit_gsp:105)
at org.grails.gsp.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:162)
at org.grails.gsp.GroovyPageWritable.writeTo(GroovyPageWritable.java:82)
at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:76)
at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.grails.web.sitemesh.GrailsLayoutView.renderInnerView(GrailsLayoutView.java:150)
at org.grails.web.sitemesh.GrailsLayoutView.obtainContent(GrailsLayoutView.java:128)
at org.grails.web.sitemesh.GrailsLayoutView.renderTemplate(GrailsLayoutView.java:63)
at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Environment Information

  • **Operating System: Ubuntu - x86_64 GNU/Linux
    | Grails Version: 3.2.4
    | Groovy Version: 2.4.7
    | JVM Version: 1.8.0_92

Example Application

  • TODO: link to github repository with example that reproduces the issue
@jameskleeh
Copy link
Contributor

The issue is in the fields plugin. Please file an issue there: https://github.com/grails-fields-plugin/grails-fields/issues

@angsuman
Copy link
Author

The reasons I added this issue here are as follows:

  1. It appears Grails have incorporated the fields plugin internally because I cannot see it loaded in build.gradle
  2. I haven't personally included it either. The case I have given is without any extra plugins loaded beyond default
  3. It affects all Grails users and not just users of fields plugin
  4. Did I mention they have similar (not same) open issues since early 2016?

@jameskleeh
Copy link
Contributor

jameskleeh commented Feb 23, 2017

  1. That doesn't mean issues should be created in a central location
  2. See bullet 1
  3. Only users that use the fields plugin, not all users
  4. Seems like a great opportunity for you to submit pull requests to fix those issues!

@angsuman
Copy link
Author

angsuman commented Feb 23, 2017

No, that is where you misunderstand. Create a grails project (without loading any plugin on your own). Add the two files (provided above) and do a generate-all. The views generated by grails uses the f:all on it's own. That is the default and there seems to be no way to override it through configuration.

@angsuman
Copy link
Author

So it affects all grails users who uses embedded objects

@jameskleeh
Copy link
Contributor

Please create the issue in the fields plugin repository and we will look into it

@jeffscottbrown
Copy link
Member

The views generated by grails uses the f:all on it's own.

That tag comes from the fields plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants