From cf9ab4d30278311e672a7afaf140edc3bba81aa3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 17 Feb 2017 10:26:12 +0100 Subject: [PATCH] synchronize modifications of output stream in tag writer --- src/main/java/eu/siacs/conversations/xml/TagWriter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xml/TagWriter.java b/src/main/java/eu/siacs/conversations/xml/TagWriter.java index be32ec5f8..ddb1024c8 100644 --- a/src/main/java/eu/siacs/conversations/xml/TagWriter.java +++ b/src/main/java/eu/siacs/conversations/xml/TagWriter.java @@ -38,7 +38,7 @@ public class TagWriter { public TagWriter() { } - public void setOutputStream(OutputStream out) throws IOException { + public synchronized void setOutputStream(OutputStream out) throws IOException { if (out == null) { throw new IOException(); } @@ -54,7 +54,7 @@ public class TagWriter { return this; } - public TagWriter writeTag(Tag tag) throws IOException { + public synchronized TagWriter writeTag(Tag tag) throws IOException { if (outputStream == null) { throw new IOException("output stream was null"); } @@ -63,7 +63,7 @@ public class TagWriter { return this; } - public TagWriter writeElement(Element element) throws IOException { + public synchronized TagWriter writeElement(Element element) throws IOException { if (outputStream == null) { throw new IOException("output stream was null"); } @@ -101,7 +101,7 @@ public class TagWriter { return outputStream != null; } - public void forceClose() { + public synchronized void forceClose() { finish(); if (outputStream != null) { try {