refactor: tabs -> spaces and stylecheck
diff --git a/src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java b/src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java index 51c3fb7..d7b1b87 100644 --- a/src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java +++ b/src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java
@@ -16,10 +16,10 @@ import java.net.URI; import java.net.URISyntaxException; -import org.eclipse.yasson.internal.DeserializationContextImpl; - import jakarta.json.bind.JsonbException; +import org.eclipse.yasson.internal.DeserializationContextImpl; + /** * Deserializer of the {@link URI} type. */ @@ -32,10 +32,10 @@ @Override Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { try { - return new URI(value); - } catch (URISyntaxException e) { - // Exception will be caught and wrapped - throw new JsonbException("java.net.URI could not parse value " + value, e); - } + return new URI(value); + } catch (URISyntaxException e) { + // Exception will be caught and wrapped + throw new JsonbException("java.net.URI could not parse value " + value, e); + } } }
diff --git a/src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java b/src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java index c73b518..dbe7980 100644 --- a/src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java +++ b/src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java
@@ -12,12 +12,12 @@ package org.eclipse.yasson.internal.deserializer.types; -import jakarta.json.bind.JsonbException; - import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; +import jakarta.json.bind.JsonbException; + import org.eclipse.yasson.internal.DeserializationContextImpl; /** @@ -34,7 +34,8 @@ try { return new URL(value); } catch (MalformedURLException e) { - throw new JsonbException("java.net.URL could not parse value " + value, e); + // Exception will be caught and wrapped + throw new JsonbException("java.net.URL could not parse value " + value, e); } } }
diff --git a/src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java b/src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java index bda21fa..c9f5991 100644 --- a/src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java +++ b/src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java
@@ -72,7 +72,7 @@ String expected = "{\"customInterface\":{\"value\":\"value1\"}}"; assertEquals(expected, defaultJsonb.toJson(unsupported)); try { - defaultJsonb.fromJson(expected, ClassWithUnsupportedFields.class); + defaultJsonb.fromJson(expected, ClassWithUnsupportedFields.class); fail("Should report an error"); } catch (JsonbException e) { assertTrue(e.getMessage().contains("Cannot infer a type")); @@ -136,11 +136,11 @@ @Test public void testMissingFieldIgnored() { - assertThrows(JsonbException.class, () -> { - Jsonb defaultConfig = JsonbBuilder.create(new JsonbConfig().setProperty(FAIL_ON_UNKNOWN_PROPERTIES, true)); - String json = "{\"nestedPojo\":{\"integerValue\":10,\"missingField\":5},\"optionalLong\":11}"; - SupportedTypes result = defaultConfig.fromJson(json, SupportedTypes.class); - }); + assertThrows(JsonbException.class, () -> { + Jsonb defaultConfig = JsonbBuilder.create(new JsonbConfig().setProperty(FAIL_ON_UNKNOWN_PROPERTIES, true)); + String json = "{\"nestedPojo\":{\"integerValue\":10,\"missingField\":5},\"optionalLong\":11}"; + SupportedTypes result = defaultConfig.fromJson(json, SupportedTypes.class); + }); } @Test @@ -229,19 +229,19 @@ @Test public void testMalformedURL() { - Type type = new TestTypeToken<ScalarValueWrapper<URL>>(){}.getType(); - assertFail("{\"value\":\"www.oracle.com\"}", type, "value", URL.class); + Type type = new TestTypeToken<ScalarValueWrapper<URL>>(){}.getType(); + assertFail("{\"value\":\"www.oracle.com\"}", type, "value", URL.class); } @Test public void testMalformedURI() { - Type type = new TestTypeToken<ScalarValueWrapper<URI>>(){}.getType(); - assertFail("{\"value\":\"www .oracle .com\"}", type, "value", URI.class); + Type type = new TestTypeToken<ScalarValueWrapper<URI>>(){}.getType(); + assertFail("{\"value\":\"www .oracle .com\"}", type, "value", URI.class); } private void assertFail(String json, Type type, String failureProperty, Class<?> failurePropertyClass) { try { - defaultJsonb.fromJson(json, type); + defaultJsonb.fromJson(json, type); fail("Expected to catch JsonbException but did not"); } catch (JsonbException e) { if(!e.getMessage().contains(failureProperty) || !e.getMessage().contains(failurePropertyClass.getName())) {