yeison / snakeyaml

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

Empty tags should not force explicit document start #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The rather complicated condition in the emitter that determines whether to emit 
"---" for the explicit document start has as part of its boolean check that the 
document start event's tags == null. However, it should also check if 
tags.isEmpty(). In JRuby I passed an empty map, since nulls are bad (mmkay?) 
and could not figure out why it always had an explicit document start.

Patch here: https://gist.github.com/2522647

Original issue reported on code.google.com by head...@headius.com on 28 Apr 2012 at 11:56

GoogleCodeExporter commented 9 years ago
There is no problem to apply the patch to be included in the next release 
because all the tests stay green.
Can you may be provide more info to understand the context ? Can it only happen 
when you use low-level API and you create the events outside of SnakeYAML ?

Original comment by py4fun@gmail.com on 30 Apr 2012 at 10:36

GoogleCodeExporter commented 9 years ago
Yes, that's correct. In JRuby's use of SnakeYAML, we are using the emitter and 
parser APIs directly, and the emitter events are being constructed by us to 
feed to the Ruby half of the YAML API. Because of the way we work with these 
events, it's common for us to have an empty map passed in for tags rather than 
a null map. It does seem that SnakeYAML should treat an empty map like no tags 
at all.

Original comment by head...@headius.com on 28 Sep 2012 at 9:34

GoogleCodeExporter commented 9 years ago

Original comment by py4fun@gmail.com on 29 Sep 2012 at 12:47