Closed GoogleCodeExporter closed 9 years ago
classTags instance is created in line 49
Can you please provide a test with a failure ?
I did not quite catch your last statement.
Original comment by aso...@gmail.com
on 26 Apr 2010 at 10:26
Yes it is, but line 49 is not beeing executed if you instantiate by the
constructor
public JavaBeanDumper(Representer representer, DumperOptions options) { in line
59
To reproduce just instantiate JavaBeanDumper(null, new DumperOptions()) and
call dump(..)
Original comment by lerch.jo...@gmail.com
on 27 Apr 2010 at 6:32
I suggest to change:
public JavaBeanDumper(Representer representer, DumperOptions options) {
this.options = options;
this.representer = representer;
}
to:
public JavaBeanDumper(Representer representer, DumperOptions options) {
this(false);
this.options = options;
this.representer = representer;
}
Original comment by lerch.jo...@gmail.com
on 27 Apr 2010 at 6:34
I have added testDumpObject2 to
http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyam
l/JavaB
eanDumperTest.java
It works properly. There is no failure.
Can you please provide a test ?
Original comment by py4fun@gmail.com
on 27 Apr 2010 at 9:46
Your test is not doing what i was writing.
Instantiate with null, not with new Representer().
In method dump(Object, Writer) is this if statement:
if (this.representer == null) {
repr = new Representer();
for (Class<? extends Object> clazz : classTags) {
repr.addClassTag(clazz, Tag.MAP);
}
} else {
repr = this.representer;
}
This will only break, if this.representer is null and the foreach will iterate
over
the not initialized value "classTags"
Original comment by lerch.jo...@gmail.com
on 27 Apr 2010 at 9:59
I got the point. The checks are added to display a proper message for a 'null'
argument:
http://code.google.com/p/snakeyaml/source/detail?
r=191df57ec54b599e91071b356a670731cc8e84f5
Does it fix the issue ?
Original comment by py4fun@gmail.com
on 27 Apr 2010 at 10:22
Okay, this is also a way to fix it. Thanks.
Original comment by lerch.jo...@gmail.com
on 27 Apr 2010 at 11:02
It will be delivered in version 1.7
Original comment by aso...@gmail.com
on 28 Apr 2010 at 7:32
Original issue reported on code.google.com by
lerch.jo...@gmail.com
on 26 Apr 2010 at 2:27