diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
index e1aef4773..53d0428eb 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
@@ -289,6 +289,8 @@ public class PacketParserUtils {
break outerloop;
}
break;
+ case XmlPullParser.TEXT:
+ throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of ");
}
}
@@ -589,6 +591,8 @@ public class PacketParserUtils {
break outerloop;
}
break;
+ case XmlPullParser.TEXT:
+ throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of ");
}
}
return presence;
@@ -645,6 +649,8 @@ public class PacketParserUtils {
break outerloop;
}
break;
+ case XmlPullParser.TEXT:
+ throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of ");
}
}
// Decide what to do when an IQ packet was not understood
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
index 117e9e3c1..e24196d15 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
@@ -710,8 +710,8 @@ public class PacketParserUtilsTest {
try {
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
fail("Exception should be thrown");
- } catch(XmlPullParserException e) {
- assertTrue(e.getMessage().contains("end tag name