The following yaml documents cannot be read, but should.
--- !!org.yaml.snakeyaml.noprop.BeanHolder bean : !!org.yaml.snakeyaml.noprop.Bean1
--- !!org.yaml.snakeyaml.noprop.BeanHolder
The attached patch contains testcases that reproduce the problem.
- noprop.patch 9.35KB
Comment #1
Posted on Jul 24, 2009 by Massive RhinoThank you. This is in fact not a bug but a feature request. Because {} are not used for the leaf bean SnakeYAML tries to construct a scalar. Since there is no single-argument (the empty String as the argument) constructor it fails. Nevertheless this is an interesting case. I will think how we can improve the implementation.
Comment #2
Posted on Jul 27, 2009 by Massive RhinoQuestion: if a Java instance is created out of following YAML document:
"!!com.package.Name" and 2 constructors are present in the Name class: no-argument constructor and with a String argument which constructor shall be used and why ?
Current situation:
"!!com.package.Name {}" - empty constructor is called
"!!com.package.Name" - constructor with an empty String is called
Comment #3
Posted on Aug 4, 2009 by Massive RhinoComment deleted
Comment #4
Posted on Aug 4, 2009 by Massive RhinoComment deleted
Comment #5
Posted on Aug 5, 2009 by Massive RhinoComment deleted
Comment #6
Posted on Aug 5, 2009 by Massive RhinoComment deleted
Comment #7
Posted on Aug 5, 2009 by Massive RhinoFixed.
Take the latest source and check:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyaml/issu
es/issue9/NopropTest.java
The support is done via a custom Constructor (BeanConstructor). We need that because there is more then 1 way to create an instance.
Comment #8
Posted on Aug 6, 2009 by Grumpy Horse(No comment was entered for this change.)
Status: Fixed
Labels:
Type-Enhancement
Priority-Medium
Milestone-Release1.4