From c1b32f8e11e865aa95eb96f266a3cafe28fc3ee0 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 23 Sep 2020 17:23:33 +0200 Subject: [PATCH] [carbons] Throw SmackParsingException instead of IOException --- .../smackx/carbons/provider/CarbonManagerProvider.java | 3 +-- .../test/java/org/jivesoftware/smackx/carbons/CarbonTest.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java index e224d6e3d..a534e4749 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java @@ -55,8 +55,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider tag"); + throw new SmackParsingException("sent/received must contain exactly one element"); } return new CarbonExtension(dir, fwd); } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java index fb88f6e95..6f2836dff 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java @@ -19,9 +19,9 @@ package org.jivesoftware.smackx.carbons; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import java.io.IOException; import java.util.Properties; +import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.test.util.SmackTestUtil; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.xml.XmlPullParser; @@ -107,6 +107,6 @@ public class CarbonTest extends ExperimentalInitializerTest { .a("xmlns", "urn:xmpp:forwarded:0") .asString(outputProperties); - assertThrows(IOException.class, () -> SmackTestUtil.parse(control, CarbonManagerProvider.class, parserKind)); + assertThrows(SmackParsingException.class, () -> SmackTestUtil.parse(control, CarbonManagerProvider.class, parserKind)); } }