1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Merge branch '4.0'

Conflicts:
	build.gradle
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java
This commit is contained in:
Florian Schmaus 2014-09-05 22:06:58 +02:00
commit 34bc13bec7
7 changed files with 110 additions and 21 deletions

View file

@ -67,7 +67,7 @@ public class ParsingExceptionTest {
try {
PacketParserUtils.parseMessage(parser);
} catch (Exception e) {
content = PacketParserUtils.parseContentDepth(parser, parserDepth);
content = PacketParserUtils.parseContentDepth(parser, parserDepth, false);
}
assertThat(MESSAGE_EXCEPTION_ELEMENT + EXTENSION2 + "</message>", equalsCharSequence(content));
}

View file

@ -24,9 +24,14 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier;
import org.jivesoftware.smack.packet.Message;
@ -34,6 +39,7 @@ import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.test.util.TestUtils;
import org.junit.Test;
import org.xml.sax.SAXException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -790,6 +796,23 @@ public class PacketParserUtilsTest {
assertEquals("", content);
}
@Test
public void parseElementMultipleNamespace()
throws ParserConfigurationException,
FactoryConfigurationError, XmlPullParserException,
IOException, TransformerException, SAXException {
// @formatter:off
final String stanza = XMLBuilder.create("outer", "outerNamespace").a("outerAttribute", "outerValue")
.element("inner", "innerNamespace").a("innverAttribute", "innerValue")
.element("innermost")
.t("some text")
.asString();
// @formatter:on
XmlPullParser parser = TestUtils.getParser(stanza, "outer");
CharSequence result = PacketParserUtils.parseElement(parser, true);
assertXMLEqual(stanza, result.toString());
}
private String determineNonDefaultLanguage() {
String otherLanguage = "jp";
Locale[] availableLocales = Locale.getAvailableLocales();