Closed GoogleCodeExporter closed 9 years ago
What is the problem that you are trying to solve ? Can please show us some code
which you expect to work with your change ?
Original comment by py4fun@gmail.com
on 21 Jul 2014 at 3:08
Well, I have not changed anything. Basicly I'm trying to dump (and load) a
JavaBean (DiceBean in this example). I want to use a custom Constructor and
Representer for one of the fields of the JavaBean (treasure here with the Dice
class). If you run the test mentioned above then you will see that SnakeYAML
will dump it correctly (like I want it to dump it) but it isn't able to load
the dumped document again because it does not use the custom Constructor
registered before. It should basicly work like the test with the map:
https://code.google.com/p/snakeyaml/source/browse/src/test/java/examples/DiceExa
mpleTest.java?name=v1.13#93
The map works correctly, but loading the JavaBean throws an exception.
Original comment by d...@minecrell.net
on 22 Jul 2014 at 6:42
I think this is definitely a bug.
It works with a Map because type is not set for the Node (it's Object) and
{{{
if (isResolved() && !Object.class.equals(type) && !tag.equals(Tag.NULL)) {
return true;
}
}}}
is not triggered. So Node.useClassConstructor returns false. As a result
BaseConstructor.getConstructor() selects constructor based on the Tag (one set
for !dice)
In case of JavaBean the type of treasure property resolved and
Node.useClassConstructor returns true - BaseConstructor.getConstructor()
selects constructor based on NodeType - Scalar and ScalarConstructor doesn't
know how to deal with 10d10...
Original comment by alexande...@gmail.com
on 22 Jul 2014 at 7:15
Any idea how this could be fixed?
Original comment by d...@minecrell.net
on 18 Aug 2014 at 7:26
Checkout out latest changes and try, please.
I don't really like a solution I have chosen. But at the moment I don't see a
better way with the current design.
Original comment by alexande...@gmail.com
on 18 Aug 2014 at 12:59
[deleted comment]
That seems to be working in my test project I made. I will test it in my real
project later but I think that fixed it. Thank you!
Original comment by d...@minecrell.net
on 18 Aug 2014 at 1:18
I declare this one fixed.
Original comment by alexande...@gmail.com
on 29 Aug 2014 at 12:02
Original issue reported on code.google.com by
d...@minecrell.net
on 21 Jul 2014 at 8:20