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 9b08d6572..ddcb5a8ac 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 @@ -1,6 +1,6 @@ /** * - * Copyright 2003-2007 Jive Software, 2019 Florian Schmaus. + * Copyright 2003-2007 Jive Software, 2019-2021 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,9 +76,9 @@ public class PacketParserUtils { return getParserFor(new StringReader(stanza)); } - public static XmlPullParser getParserFor(InputStream inputStream) throws XmlPullParserException { + public static XmlPullParser getParserFor(InputStream inputStream) throws XmlPullParserException, IOException { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); - return SmackXmlParser.newXmlParser(inputStreamReader); + return getParserFor(inputStreamReader); } public static XmlPullParser getParserFor(Reader reader) throws XmlPullParserException, IOException { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java index af8426029..f8df83f83 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java @@ -67,7 +67,6 @@ public class AMPExtensionTest { AMPExtensionProvider ampProvider = new AMPExtensionProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(INCORRECT_RECEIVING_STANZA_STREAM); - assertEquals(XmlPullParser.Event.START_ELEMENT, parser.next()); assertEquals(AMPExtension.ELEMENT, parser.getName()); ExtensionElement extension = ampProvider.parse(parser); @@ -85,7 +84,6 @@ public class AMPExtensionTest { AMPExtensionProvider ampProvider = new AMPExtensionProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(CORRECT_SENDING_STANZA_STREAM); - assertEquals(XmlPullParser.Event.START_ELEMENT, parser.next()); assertEquals(AMPExtension.ELEMENT, parser.getName()); ExtensionElement extension = ampProvider.parse(parser); assertTrue(extension instanceof AMPExtension); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java index 67557c553..5505e4dda 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java @@ -39,7 +39,6 @@ public class XHTMLExtensionProviderTest { public void parsesWell() throws IOException, XmlPullParserException { InputStream inputStream = getClass().getResourceAsStream(XHTML_EXTENSION_SAMPLE_RESOURCE_NAME); XmlPullParser parser = PacketParserUtils.getParserFor(inputStream); - parser.next(); XHTMLExtensionProvider provider = new XHTMLExtensionProvider(); ExtensionElement extension = provider.parse(parser, parser.getDepth(), null);