diff --git a/binding/src/main/java/org/jsonx/ObjectCodec.java b/binding/src/main/java/org/jsonx/ObjectCodec.java index 90b75489..12172a3f 100644 --- a/binding/src/main/java/org/jsonx/ObjectCodec.java +++ b/binding/src/main/java/org/jsonx/ObjectCodec.java @@ -160,10 +160,11 @@ else if (codec instanceof ArrayCodec) { return abort(Error.DECODE_EXCEPTION(reader, e), reader, index); } catch (final InvocationTargetException e) { - if (e.getCause() instanceof IOException) - throw (IOException)e.getCause(); + final Throwable cause = e.getCause(); + if (cause instanceof IOException) + throw (IOException)cause; - return abort(Error.DECODE_EXCEPTION(reader, e.getCause()), reader, index); + return abort(Error.DECODE_EXCEPTION(reader, cause), reader, index); } catch (final InstantiationException e) { throw new RuntimeException(Throwables.copy(e, new InstantiationException(type.getName()))); diff --git a/jsonx-maven-plugin/pom.xml b/jsonx-maven-plugin/pom.xml index 0bc9f49a..11f46000 100644 --- a/jsonx-maven-plugin/pom.xml +++ b/jsonx-maven-plugin/pom.xml @@ -84,7 +84,7 @@ src/test/resources/test.jsd src/test/resources/test.jsdx - src/test/resources/camera.jsdx + src/test/resources/sensor.jsdx @@ -106,7 +106,7 @@ src/test/resources/test.jsd src/test/resources/test.jsdx - src/test/resources/camera.jsdx + src/test/resources/sensor.jsdx @@ -120,7 +120,7 @@ src/test/resources/test.jsd src/test/resources/test.jsdx - src/test/resources/camera.jsdx + src/test/resources/sensor.jsdx diff --git a/jsonx-maven-plugin/src/test/java/org/jsonx/CameraITest.java b/jsonx-maven-plugin/src/test/java/org/jsonx/SensorITest.java similarity index 73% rename from jsonx-maven-plugin/src/test/java/org/jsonx/CameraITest.java rename to jsonx-maven-plugin/src/test/java/org/jsonx/SensorITest.java index d188ecee..1c6b6786 100644 --- a/jsonx-maven-plugin/src/test/java/org/jsonx/CameraITest.java +++ b/jsonx-maven-plugin/src/test/java/org/jsonx/SensorITest.java @@ -22,15 +22,15 @@ import org.openjax.json.JsonReader; public class CameraITest { - private static final String json = "{\"cameras\":[{\"ordinal\":0,\"state\":\"manual\",\"dois\":5,\"pan\":0.0,\"tilt\":0.0,\"zoom\":1.0},{\"ordinal\":1,\"state\":\"manual\",\"dois\":5}],\"periods\":[[1619506964,60]],\"captureDelay\":0}"; + private static final String json = "{\"sensors\":[{\"index\":0,\"mode\":\"auto\",\"facets\":5,\"x\":0.0,\"y\":0.0,\"z\":1.0},{\"index\":1,\"mode\":\"auto\",\"facets\":5}],\"sequences\":[[1619506964,60]],\"delay\":0}"; @Test public void test() throws IOException, DecodeException { - final oz.Capture capture; + final stub.Assembly assembly; try (final JsonReader in = new JsonReader(json)) { - capture = JxDecoder.VALIDATING.parseObject(in, oz.Capture.class); + assembly = JxDecoder.VALIDATING.parseObject(in, stub.Assembly.class); } - System.out.println(capture); + System.out.println(assembly); } } \ No newline at end of file diff --git a/jsonx-maven-plugin/src/test/resources/camera.jsdx b/jsonx-maven-plugin/src/test/resources/sensor.jsdx similarity index 59% rename from jsonx-maven-plugin/src/test/resources/camera.jsdx rename to jsonx-maven-plugin/src/test/resources/sensor.jsdx index 5397e529..3e73d763 100644 --- a/jsonx-maven-plugin/src/test/resources/camera.jsdx +++ b/jsonx-maven-plugin/src/test/resources/sensor.jsdx @@ -18,9 +18,9 @@ xmlns="http://www.jsonx.org/schema-0.4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jsonx.org/schema-0.4.xsd http://www.jsonx.org/schema.xsd" - targetNamespace="http://www.jsonx.org/jsonx-maven-plugin/test/camera.jsdx"> + targetNamespace="http://www.jsonx.org/jsonx-maven-plugin/test/sensor.jsdx"> - + @@ -37,36 +37,37 @@ + - + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - + +