public class test {
public static void main (String[] args)
{
String a = "---\na: this is\nb: test,please,help\nc: 'thanks'";
System.out.println("testing: " + a);
Yaml.load(a);
}
}
I'm trying to parse YAML passed to me from a third party. In this case, there's a string "test,please,help" that's not quoted.
org.ho.yaml.Yaml version 1.3 generates an exception:
Exception in thread "main" org.ho.yaml.exception.YamlException: Error near line 3: Unterminated inline value
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)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.Yaml.load(Unknown Source)
at test.main(test.java:8)
If I quote the string, it is successfully parsed. Unfortunately I am not in control of the YAML that's generated -- I'm just responsible from parsing it.
Is org.ho.yaml.Yaml correct in throwing an exception because the Yaml is 'malformed,' or should org.ho.yaml.Yaml be able to deal with commas in string literals?
thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Example program 'test.java':
import org.ho.yaml.Yaml;
public class test {
public static void main (String[] args)
{
String a = "---\na: this is\nb: test,please,help\nc: 'thanks'";
System.out.println("testing: " + a);
Yaml.load(a);
}
}
I'm trying to parse YAML passed to me from a third party. In this case, there's a string "test,please,help" that's not quoted.
org.ho.yaml.Yaml version 1.3 generates an exception:
Exception in thread "main" org.ho.yaml.exception.YamlException: Error near line 3: Unterminated inline value
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)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.Yaml.load(Unknown Source)
at test.main(test.java:8)
If I quote the string, it is successfully parsed. Unfortunately I am not in control of the YAML that's generated -- I'm just responsible from parsing it.
Is org.ho.yaml.Yaml correct in throwing an exception because the Yaml is 'malformed,' or should org.ho.yaml.Yaml be able to deal with commas in string literals?
thanks!