Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #61 from zanata/rhbz986145
Browse files Browse the repository at this point in the history
rhbz986145 Check for IO error after each write
  • Loading branch information
carlosmunoz committed Jul 22, 2013
2 parents d4c6611 + 8f83014 commit 6b66c90
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -25,7 +25,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Iterator;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -79,7 +78,7 @@ public void write(OutputStream output) throws IOException, WebApplicationExcepti
if (iter.hasNext()) iter.peek();

@Cleanup
Writer writer = new PrintWriter(output);
PrintWriter writer = new PrintWriter(output);
@Cleanup
XMLWriter xmlWriter = new XMLWriter(writer);
@Cleanup
Expand All @@ -102,6 +101,10 @@ public void write(OutputStream output) throws IOException, WebApplicationExcepti
SourceContents tu = iter.next();
net.sf.okapi.common.LocaleId sourceLocale = OkapiUtil.toOkapiLocale(tu.getLocale());
exportTUStrategy.exportTranslationUnit(tmxWriter, tu, sourceLocale);
if (writer.checkError())
{
throw new IOException("error writing to output");
}
}
tmxWriter.writeEndDocument();
}
Expand Down

0 comments on commit 6b66c90

Please sign in to comment.