yeison / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

Unable to reload property derived from Map #142

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simply compile & run attached standalone class

_____________________________
What is the expected output? What do you see instead?

Expected to load dumped object, but instead got the following exception:

Caused by: org.yaml.snakeyaml.error.YAMLException: Cannot create
property=moreFeatures for JavaBean=DerivedMapTest$MyObject@13a317a;
argument type mismatch
    at org.yaml.snakeyaml.constructor.Constructor
$ConstructMapping.constructJavaBean2ndStep(Constructor.java:299)
    at org.yaml.snakeyaml.constructor.Constructor
$ConstructMapping.construct(Constructor.java:189)
    at org.yaml.snakeyaml.constructor.Constructor
$ConstructYamlObject.construct(Constructor.java:331) 

MyObject has two map attributes: features (works fine) and moreFreatures, that 
causes the problem because it is of Features type that extends LinkedHashmap

I tried to use a custom constructor, but seems that the result is the
same.

Looks like SnakeYaml whenever recognises a map, creates a linked hash
map and then tries to set the attribute property (that obviously fails).

___________________________
What version of SnakeYAML are you using? On what Java version?
1.11-SNAPSHOT (Maven) on Java 1.6.0_23 & 1.7.0

Original issue reported on code.google.com by graziosi...@gmail.com on 21 Feb 2012 at 11:58

Attachments:

GoogleCodeExporter commented 9 years ago
You can check the latest development in
http://code.google.com/r/alexandermaslov-sny-beancontrol/source/checkout

Original comment by py4fun@gmail.com on 21 Feb 2012 at 3:34