YAML Dates not parsed correctly
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Invalid
|
Undecided
|
Unassigned | |||
1.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
When parsing a YAML file the Fixture.load() method uses Snake YAML to create an object graph, and then converts all values in the graph to strings, and then converts them back to objects. This works for most objects, however not for YAML dates.
eg "2001-12-
One possible solution would be to avoid converting Date objects to a String in the first place, as snake YAML already parses the dates correctly.
See http://
The fix for this is to change one line in play.test. Fixtures. java (in play 1.1 it is line number 192).
Change this:
for(Field f : model.getClass( ).getFields( )) { ).isAssignableF rom(Map. class)) {
f.set( model, objects. get(key) .get(f. getName( )));
// TODO: handle something like FileAttachment
if (f.getType(
}
}
To this:
for(Field f : model.getClass( ).getFields( )) { ).isAssignableF rom(Map. class) ||
f. getType( ).isAssignableF rom(java. util.Date. class)) {
f.set( model, objects. get(key) .get(f. getName( )));
// TODO: handle something like FileAttachment
if (f.getType(
}
}