1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-15 03:59:38 +02:00

Make Provider.parse() just throw Exception

instead of throwing XmlPullParserException, IOException and
SmackException.

Add a guard to AbstractXMPPConnection.processPacket() to always re-throw
RuntimeExceptions.
This commit is contained in:
Florian Schmaus 2015-03-13 09:27:18 +01:00
parent 4d9bd6f216
commit bc093b620d
29 changed files with 63 additions and 156 deletions

View file

@ -18,19 +18,15 @@ package org.jivesoftware.smackx.caps.provider;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smackx.InitExtensions;
import org.jivesoftware.smackx.caps.packet.CapsExtension;
import org.junit.Test;
import org.xmlpull.v1.XmlPullParserException;
public class CapsExtensionProviderTest extends InitExtensions {
@Test
public void parseTest() throws XmlPullParserException, IOException, SmackException {
public void parseTest() throws Exception {
// @formatter:off
final String capsExtensionString =
"<c xmlns='http://jabber.org/protocol/caps'"

View file

@ -19,9 +19,6 @@ package org.jivesoftware.smackx.xdata.packet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.xdata.FormField;
@ -35,7 +32,6 @@ import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.RangeValidateElement;
import org.junit.Test;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* Unit tests for DataForm reading and parsing.
@ -51,7 +47,7 @@ public class DataFormTest {
DataFormProvider pr = new DataFormProvider();
@Test
public void test() throws XmlPullParserException, IOException, SmackException {
public void test() throws Exception {
//Build a Form
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
@ -78,7 +74,7 @@ public class DataFormTest {
}
@Test
public void testLayout() throws XmlPullParserException, IOException, SmackException {
public void testLayout() throws Exception {
//Build a Form
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
@ -120,7 +116,7 @@ public class DataFormTest {
}
@Test
public void testValidation() throws XmlPullParserException, IOException, SmackException {
public void testValidation() throws Exception {
//Build a Form
DataForm df = new DataForm(DataForm.Type.submit);
String instruction = "InstructionTest1";
@ -154,7 +150,7 @@ public class DataFormTest {
}
@Test
public void testFixedField() throws XmlPullParserException, IOException, SmackException {
public void testFixedField() throws Exception {
final String formWithFixedField = "<x xmlns='jabber:x:data' type='submit'><instructions>InstructionTest1</instructions><field type='fixed'></field></x>";
DataForm df = pr.parse(PacketParserUtils.getParserFor(formWithFixedField));
assertEquals(Type.fixed, df.getFields().get(0).getType());

View file

@ -47,7 +47,7 @@ public class DataLayoutTest {
private static final String TEST_INPUT_1 = "xdata-layout-sample.xml";
@Test
public void testLayout() throws XmlPullParserException, IOException, SmackException {
public void testLayout() throws Exception {
DataLayout layout = new DataLayout("Label");
Fieldref reffield = new Fieldref("testField1");
layout.getPageLayout().add(reffield);
@ -116,7 +116,7 @@ public class DataLayoutTest {
}
@Test
public void testLayoutFromFile() throws XmlPullParserException, IOException, SmackException {
public void testLayoutFromFile() throws Exception {
DataFormProvider pr = new DataFormProvider();
XmlPullParser parser = PacketParserUtils.newXmppParser();