XLIFF2 Filter: crashes parsing any file containing a group
Pretty bad bug: we crash extracting any XLIFF2 file that contains a element, which is most files.
I can reproduce this with the test01.xlf file which is part of the unittest data for the filter (!), and I've also attached. (The unittest that uses it just verifies that a particular TU is extracted, but does not complete parsing -- since the bug occurs on END_GROUP events, the test doesn't hit it.)
The issue is that the filter is trying to call into xliff-toolkit serialization methods to write out certain elements as skeleton, but those methods depend on internal state (eg the group stack) which isn't being tracked properly when called from the filter. xliff-toolkit's XLIFFReader class has no problem handling this file.
Stack trace looks like this:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
at net.sf.okapi.lib.xliff2.writer.XLIFFWriter.writeEndGroup(XLIFFWriter.java:1058)
at net.sf.okapi.filters.xliff2.XLIFF2Filter.convEndGroup(XLIFF2Filter.java:338)
at net.sf.okapi.filters.xliff2.XLIFF2Filter.readNext(XLIFF2Filter.java:249)
at net.sf.okapi.filters.xliff2.XLIFF2Filter.next(XLIFF2Filter.java:185)