Closed GoogleCodeExporter closed 9 years ago
I have added FIXME statements in clone:
http://code.google.com/r/py4fun-deprecate-javabeandumper/source/browse
http://code.google.com/r/py4fun-deprecate-javabeandumper/source/browse/src/test/
java/examples/jodatime/JodaTimeExampleTest.java
Original comment by py4fun@gmail.com
on 13 Jul 2011 at 4:39
I have more information now. The title is wrong. The tag is not redundant.
Explicit tag must be used. Otherwise implicit tags are ignored for JavaBean
properties.
Joda's DateTime cannot be created from a scalar because it does not have the
corresponding contructor. Unfortunately, changing the default flow style to
BLOCK caused the tag to disappear.
The test now reflects the bug.
Original comment by py4fun@gmail.com
on 14 Jul 2011 at 8:40
Read from PyYAML: http://pyyaml.org/wiki/PyYAMLDocumentation
"The implicit flag of a scalar event is a pair of boolean values that indicate
if the tag may be omitted when the scalar is emitted in a plain and non-plain
style correspondingly."
The event is (run the test to see it):
<org.yaml.snakeyaml.events.ScalarEvent(anchor=null,
tag=tag:yaml.org,2002:timestamp, implicit=[true, false],
value=2001-09-09T01:46:40Z)>
Indeed the tag is not omitted when AUTO flow is used (and the scalar is
non-plain - it is single quoted). But there is no tag when BLOCK flow is used
(and the scalar is plain).
So it works exactly as it described. But why the AUTO flow style makes the
scalar single quoted ?
Original comment by py4fun@gmail.com
on 15 Jul 2011 at 4:59
The AUTO flow style makes the scalar single quoted because a timestamp contains
':' characters which should be escapes in the flow style.
Original comment by py4fun@gmail.com
on 26 Jul 2011 at 9:47
The problem is explained in the comments. Proposed solution does not rely on
implicit or explicit tag. See:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/examples/jodatime
/JodaTimeExampleTest.java#59
(method testLoadBeanWithBlockFlow())
Original comment by py4fun@gmail.com
on 26 Jul 2011 at 12:42
Original issue reported on code.google.com by
py4fun@gmail.com
on 13 Jul 2011 at 4:29