#42 Lone carriage returns cause dump/load problems

open
nobody
None
5
2008-10-10
2008-10-10
David M. Lee
No

I used the following code to generate the attached .yml file.
String[] wontParse = {
"ends with cr\r",
"multi\rline",
};
String yaml = Yaml.dump(wontParse);
System.out.println(yaml);

The generated file will not load properly.

The first string errors with an "Unterminated string" error.

org.ho.yaml.exception.YamlException: Error near line 2: Unterminated string
at org.ho.yaml.JYamlParserEvent.error(Unknown Source)
at org.ho.yaml.YamlDecoder.firstDocument(Unknown Source)
at org.ho.yaml.YamlDecoder.readObject(Unknown Source)
at org.ho.yaml.YamlConfig.load(Unknown Source)

The second string does not parse correctly - it terminates at the carriage return.

Discussion

  • David M. Lee
    David M. Lee
    2008-10-10

    Sample .yml file

     
    Attachments