list input fails when property is in superclass
I wrote a simple publication management system, which allows the user to input some authors when entering a new publication. It uses the following code:
entity Publication { key :: String title :: String authors <> List<Author> } entity Author { name :: String } define page newPublication() { var p := PublishedVolume {} form{ <p> "Key" </p> <p> input(p.key) </p> <p> "Title" </p> <p> input(p.title) </p> <p> "Publisher" </p> <p> input(p.publisher) </p> <p> "Authors" </p> <p> input(p.authors) </p> submit submitPub() { "Submit" } } action submitPub() { p.save(); return root(); } }
On opening the new publication page, I get a NullPointerException (there are authors present in the database):
java.lang.NullPointerException at webdsl.generated.templates.RefArg_inputListEntity_1_newPublicationpc3.getAllowed(RefArg_inputListEntity_1_newPublicationpc3.java:102) at webdsl.generated.templates.inputListEntity_Template.renderInternal(inputListEntity_Template.java:161) at utils.TemplateServlet.render(TemplateServlet.java:89) at webdsl.generated.templates.newPublication_Template.renderInternal(newPublication_Template.java:526) at utils.TemplateServlet.render(TemplateServlet.java:89) at webdsl.generated.templates.NewPublicationPage.render(NewPublicationPage.java:235) at webdsl.generated.templates.NewPublicationPage.serve(NewPublicationPage.java:161)
I guess it has something to do with the list not being initialized, but from a WebDSL perspective, this should be irrelevant (right?). The publication initialization should create an empty list for me.
Submitted by Sander Vermolen on 23 May 2011 at 12:24
Issue Log
I tried to initialize the list before using it now, but this does not solve the problem. Additionally I get the following errors:
reflection property not found: authors Problem occurred in template call: inputListEntityListEntity(list, list.getAllowed()) at ../.servletapp/src-webdsl-template/built-in.app:1064/6
What happens to the page when this error occurs?
Does it work when you change it to
authors -> List<Author>
Changing <> to -> makes no difference (same error). When the error occurs, the page loads but I do not get an input box for authors. Saving a publication (without authors) works fine.
I am able to reproduce it, working on a fix. The bug occurs when the property is in a superclass.
fixed in r4679
Log in to post comments