mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 10:37:59 +01:00
[carbons] Throw SmackParsingException instead of IOException
This commit is contained in:
parent
02341f6330
commit
c1b32f8e11
2 changed files with 3 additions and 4 deletions
|
@ -55,8 +55,7 @@ public class CarbonManagerProvider extends ExtensionElementProvider<CarbonExtens
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
if (fwd == null) {
|
if (fwd == null) {
|
||||||
// TODO: Should be SmackParseException.
|
throw new SmackParsingException("sent/received must contain exactly one <forwarded/> element");
|
||||||
throw new IOException("sent/received must contain exactly one <forwarded> tag");
|
|
||||||
}
|
}
|
||||||
return new CarbonExtension(dir, fwd);
|
return new CarbonExtension(dir, fwd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ package org.jivesoftware.smackx.carbons;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
|
@ -107,6 +107,6 @@ public class CarbonTest extends ExperimentalInitializerTest {
|
||||||
.a("xmlns", "urn:xmpp:forwarded:0")
|
.a("xmlns", "urn:xmpp:forwarded:0")
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
assertThrows(IOException.class, () -> SmackTestUtil.parse(control, CarbonManagerProvider.class, parserKind));
|
assertThrows(SmackParsingException.class, () -> SmackTestUtil.parse(control, CarbonManagerProvider.class, parserKind));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue