fixed npe
This commit is contained in:
parent
3f61742902
commit
3f872ddc9f
|
@ -47,18 +47,27 @@ public class TagWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagWriter beginDocument() throws IOException {
|
public TagWriter beginDocument() throws IOException {
|
||||||
|
if (outputStream==null) {
|
||||||
|
throw new IOException("output stream was null");
|
||||||
|
}
|
||||||
outputStream.write("<?xml version='1.0'?>");
|
outputStream.write("<?xml version='1.0'?>");
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagWriter writeTag(Tag tag) throws IOException {
|
public TagWriter writeTag(Tag tag) throws IOException {
|
||||||
|
if (outputStream==null) {
|
||||||
|
throw new IOException("output stream was null");
|
||||||
|
}
|
||||||
outputStream.write(tag.toString());
|
outputStream.write(tag.toString());
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagWriter writeElement(Element element) throws IOException {
|
public TagWriter writeElement(Element element) throws IOException {
|
||||||
|
if (outputStream==null) {
|
||||||
|
throw new IOException("output stream was null");
|
||||||
|
}
|
||||||
outputStream.write(element.toString());
|
outputStream.write(element.toString());
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue