aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/server')
-rw-r--r--juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java27
-rw-r--r--juick-server/src/main/java/com/juick/server/xmpp/s2s/ConnectionIn.java2
2 files changed, 21 insertions, 8 deletions
diff --git a/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java b/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java
index 7eacfc944..f731f039a 100644
--- a/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java
+++ b/juick-server/src/main/java/com/juick/server/xmpp/router/StreamError.java
@@ -12,6 +12,7 @@ import java.io.IOException;
public class StreamError {
private String condition;
+ private String text;
public StreamError() {}
@@ -21,13 +22,21 @@ public class StreamError {
public static StreamError parse(XmlPullParser parser) throws IOException, XmlPullParserException {
StreamError streamError = new StreamError();
- while (parser.next() == XmlPullParser.START_TAG) {
- final String tag = parser.getName();
- final String xmlns = parser.getNamespace();
- if (xmlns.equals(StreamNamespaces.NS_XMPP_STREAMS)) {
- streamError.condition = tag;
- } else {
- XmlUtils.skip(parser);
+ final int initial = parser.getDepth();
+ while (true) {
+ int eventType = parser.next();
+ if (eventType == XmlPullParser.START_TAG && parser.getDepth() == initial + 1) {
+ final String tag = parser.getName();
+ final String xmlns = parser.getNamespace();
+ if (tag.equals("text") && xmlns.equals(StreamNamespaces.NS_XMPP_STREAMS)) {
+ streamError.text = XmlUtils.getTagText(parser);
+ } else if (xmlns.equals(StreamNamespaces.NS_XMPP_STREAMS)) {
+ streamError.condition = tag;
+ } else {
+ XmlUtils.skip(parser);
+ }
+ } else if (eventType == XmlPullParser.END_TAG && parser.getDepth() == initial) {
+ break;
}
}
return streamError;
@@ -41,4 +50,8 @@ public class StreamError {
public String toString() {
return String.format("<stream:error><%s xmlns='%s'/></stream:error>", condition, StreamNamespaces.NS_XMPP_STREAMS);
}
+
+ public String getText() {
+ return text;
+ }
}
diff --git a/juick-server/src/main/java/com/juick/server/xmpp/s2s/ConnectionIn.java b/juick-server/src/main/java/com/juick/server/xmpp/s2s/ConnectionIn.java
index 9c8e375ce..72c3ba8d0 100644
--- a/juick-server/src/main/java/com/juick/server/xmpp/s2s/ConnectionIn.java
+++ b/juick-server/src/main/java/com/juick/server/xmpp/s2s/ConnectionIn.java
@@ -156,7 +156,7 @@ public class ConnectionIn extends Connection implements Runnable {
restartParser();
} else if (tag.equals("error")) {
StreamError streamError = StreamError.parse(parser);
- logger.debug("Stream error from {}: {}", streamID, streamError.getCondition());
+ logger.debug("Stream error {} from {}: {}", streamError.getCondition(), streamID, streamError.getText());
xmpp.removeConnectionIn(this);
closeConnection();
} else {