XMLWriter should check for IO errors

Issue #352 resolved
Former user created an issue

Original issue 352 created by sean.flani... on 2013-07-22T00:23:22.000Z:

What steps will reproduce the problem?
1. Use net.sf.okapi.common.XMLWriter to write to a socket (eg in a web service)
2. Close the socket (eg user cancels download)

What is the expected output? What do you see instead?
Either the write* methods should throw an exception, or failing that, PrintWriter's checkError() method should be exposed so that the caller can check for an exception.

Instead, XMLWriter silently swallows an IOException every time write is called, until eventually the caller stops writing data. This takes a lot longer than usual because of all the IOExceptions being thrown and caught.

What version of the product are you using? On what operating system?
0.21

Please provide any additional information below.

This problem also affects TMXWriter, TMXFilterWriter and XLIFFWriter which all use XMLWriter.

Comments (2)

  1. Former user Account Deleted

    Comment 1. originally posted by sean.flani... on 2013-07-22T02:14:11.000Z:

    Workaround: When constructing the XMLWriter, pass in a PrintWriter (not just a Writer), and call checkError() on the PrintWriter after each write.

  2. Log in to comment