Closed GoogleCodeExporter closed 9 years ago
SnakeYAML has a lot of tests where the error is shown (feel free to take the
source and run the tests).
Without a test case it is not clear what is failing and why the error is not
clear enough. I am afraid in this particular case the error is that the class
does not have a public empty constructor. (In this case the file position does
not help to fix the problem :)
Please provide a test case.
Original comment by py4fun@gmail.com
on 30 Apr 2012 at 10:08
Actually, problem was abstract class. So exception shouldn't be "cannot
instantiate something in big hierarchy of classes when parsing one of yaml
files", but "Cannot instantiate MySuperClass: no public constructor, or
abstract class". Moreover you can show position in yaml file (this information
is available at exception point), so there was no need to meditate over yaml or
look over tests and sources.
In this case I was forced to dig into parser sources, to find out problem class.
Original comment by theasp...@gmail.com
on 2 May 2012 at 3:07
Indeed for some exceptions the line number is shown for exception.toString()
and not shown for exception.getMessage()
Original comment by py4fun@gmail.com
on 2 May 2012 at 10:55
Fixed.
Check the test:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyam
l/issues/issue145/LineNumberInExceptionTest.java
Original comment by py4fun@gmail.com
on 2 May 2012 at 11:16
Perfect! thank you very much.
Original comment by theasp...@gmail.com
on 3 May 2012 at 2:27
It will be delivered in version 1.11:
http://code.google.com/p/snakeyaml/wiki/changes
Original comment by py4fun@gmail.com
on 4 May 2012 at 6:49
Original issue reported on code.google.com by
theasp...@gmail.com
on 24 Apr 2012 at 11:21