NullPointerException when trying to use crud.custom tag
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Fix Released
|
Undecided
|
Unassigned | |||
1.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
I got the error below when trying to use the crud.custom tag for the first time. It seems to be do to a very strict requirement in crud that only supports known types.
Here is the template.
#{crud.form fields:
I basically want to override the handling of a single field that is a
joda LocalDate (startDate). It seems like it can't even find the
property so below is a snippet of my model too. When I get rid of the
fields arg to the tag, it renders all the fields except the custom
one.
@Entity
public class CourseSection extends Model {
...
public Course course;
public LocalDate startDate;
...
Execution error occured in template {module:
form.html. Exception raised was NullPointerExce
property 'name' on null object.
In {module:
30:
31:
%{ if(fieldsHandle
32:
%{
33:
34:
(field.type == 'relation' ? '@id' : ''));
35:
def oldObject = handler.
36:
37:
38:
39:
40:
}%
Looks like ObjectField does not set the type property for anything but
know types.
public ObjectField(Field field)
This causes the ObjectType object to not add it to the field list:
public List<ObjectField> getFields() {
List fields = new ArrayList();
for (Field f : entityClass.
}
---> if (of.type != null) {
}
}
return fields;
}
That's why the field object is null when this is called in form.html:
%{ def field = currentType.
Changed in play: | |
status: | New → Fix Committed |
Changed in play: | |
status: | Incomplete → Fix Committed |
There is a typo in the fix ...