1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-29 09:42:06 +01:00

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");