yeison / snakeyaml

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

Add public methods for accessing the pertinent information about a ReaderException #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Pass any non-printable character (any in 
"[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]") to StreamReader
2.
3.

What is the expected output? What do you see instead?
N/A

What version of SnakeYAML are you using? On what Java version?
1.10-SNAPSHOT

Please provide any additional information below. (Often a failing test is
the best way to describe the problem.)
JRuby uses SnakeYAML as its YAML parser and emitter. When the parser fails, 
JRuby is thrown a ReaderException, but it might be desirable to wrap it and 
present a different error message to the user.

Currently, the only way to do this is to parse ReaderException.toString() and 
extract the information. This is obviously brittle.

ReaderException.getChar(), ReaderException.getName(), 
ReaderException.getPosition() will be welcome additions.

Original issue reported on code.google.com by asari.r...@gmail.com on 6 Jan 2012 at 1:28

GoogleCodeExporter commented 9 years ago
I meant that the non-printable characters are any in 
"[\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]", which is the complete 
opposite of what I showed above. Sorry about that.

Original comment by asari.r...@gmail.com on 6 Jan 2012 at 1:29

GoogleCodeExporter commented 9 years ago
No problem. I think ReaderException.getName() is useless, but it will be added 
anyway for completeness.

Original comment by py4fun@gmail.com on 6 Jan 2012 at 7:35

GoogleCodeExporter commented 9 years ago
Feel free to try the latest 1.10-SNAPSHOT: 
https://oss.sonatype.org/content/groups/public/org/yaml/snakeyaml/1.10-SNAPSHOT/

The fix will be delivered in version 1.10

Original comment by py4fun@gmail.com on 9 Jan 2012 at 9:13