aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xml/XmlReader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/xml/XmlReader.java')
-rw-r--r--src/eu/siacs/conversations/xml/XmlReader.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/xml/XmlReader.java b/src/eu/siacs/conversations/xml/XmlReader.java
index 25d3fe38..1c7e94e6 100644
--- a/src/eu/siacs/conversations/xml/XmlReader.java
+++ b/src/eu/siacs/conversations/xml/XmlReader.java
@@ -28,24 +28,33 @@ public class XmlReader {
this.wakeLock = wakeLock;
}
- public void setInputStream(InputStream inputStream) {
+ public void setInputStream(InputStream inputStream) throws IOException {
+ if (inputStream==null) {
+ throw new IOException();
+ }
this.is = inputStream;
try {
parser.setInput(new InputStreamReader(this.is));
} catch (XmlPullParserException e) {
- Log.d(LOGTAG,"error setting input stream");
+ throw new IOException("error resetting parser");
}
}
- public InputStream getInputStream() {
+ public InputStream getInputStream() throws IOException {
+ if (this.is==null) {
+ throw new IOException();
+ }
return is;
}
- public void reset() {
+ public void reset() throws IOException {
+ if (this.is==null) {
+ throw new IOException();
+ }
try {
parser.setInput(new InputStreamReader(this.is));
} catch (XmlPullParserException e) {
- Log.d(LOGTAG,"error resetting input stream");
+ throw new IOException("error resetting parser");
}
}