Revert "Throw exception if stanza child contains text"

This reverts commit eb9242768c.

Turns out, that there is in fact not such restriction in the
RFCs (only for <subject/>, <body/> and the a few others).
This commit is contained in:
Florian Schmaus 2017-01-24 22:46:40 +01:00
parent 62d903171f
commit 51378aebee
2 changed files with 2 additions and 8 deletions

View File

@ -290,8 +290,6 @@ public class PacketParserUtils {
break outerloop; break outerloop;
} }
break; break;
case XmlPullParser.TEXT:
throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of <message/>");
} }
} }
@ -592,8 +590,6 @@ public class PacketParserUtils {
break outerloop; break outerloop;
} }
break; break;
case XmlPullParser.TEXT:
throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of <presence/>");
} }
} }
return presence; return presence;
@ -650,8 +646,6 @@ public class PacketParserUtils {
break outerloop; break outerloop;
} }
break; break;
case XmlPullParser.TEXT:
throw new IllegalStateException("Invalid Stanza: Must not contain text or mixed content as direct child of <iq/>");
} }
} }
// Decide what to do when an IQ packet was not understood // Decide what to do when an IQ packet was not understood

View File

@ -710,8 +710,8 @@ public class PacketParserUtilsTest {
try { try {
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl)); PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
fail("Exception should be thrown"); fail("Exception should be thrown");
} catch(IllegalStateException e) { } catch(XmlPullParserException e) {
assertTrue(e.getMessage().contains("Invalid Stanza")); assertTrue(e.getMessage().contains("end tag name </body>"));
} }
invalidControl = validControl.replace("Good Message Body", "Bad </message> Body"); invalidControl = validControl.replace("Good Message Body", "Bad </message> Body");