Skip to content

Commit f9d97db

Browse files
committed
refactor: tabs -> spaces and stylecheck
1 parent f18c562 commit f9d97db

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import java.net.URI;
1717
import java.net.URISyntaxException;
1818

19-
import org.eclipse.yasson.internal.DeserializationContextImpl;
20-
2119
import jakarta.json.bind.JsonbException;
2220

21+
import org.eclipse.yasson.internal.DeserializationContextImpl;
22+
2323
/**
2424
* Deserializer of the {@link URI} type.
2525
*/
@@ -32,10 +32,10 @@ class UriDeserializer extends TypeDeserializer {
3232
@Override
3333
Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) {
3434
try {
35-
return new URI(value);
36-
} catch (URISyntaxException e) {
37-
// Exception will be caught and wrapped
38-
throw new JsonbException("java.net.URI could not parse value " + value, e);
39-
}
35+
return new URI(value);
36+
} catch (URISyntaxException e) {
37+
// Exception will be caught and wrapped
38+
throw new JsonbException("java.net.URI could not parse value " + value, e);
39+
}
4040
}
4141
}

src/main/java/org/eclipse/yasson/internal/deserializer/types/UrlDeserializer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
package org.eclipse.yasson.internal.deserializer.types;
1414

15-
import jakarta.json.bind.JsonbException;
16-
1715
import java.lang.reflect.Type;
1816
import java.net.MalformedURLException;
1917
import java.net.URL;
2018

19+
import jakarta.json.bind.JsonbException;
20+
2121
import org.eclipse.yasson.internal.DeserializationContextImpl;
2222

2323
/**
@@ -34,7 +34,8 @@ Object deserializeStringValue(String value, DeserializationContextImpl context,
3434
try {
3535
return new URL(value);
3636
} catch (MalformedURLException e) {
37-
throw new JsonbException("java.net.URL could not parse value " + value, e);
37+
// Exception will be caught and wrapped
38+
throw new JsonbException("java.net.URL could not parse value " + value, e);
3839
}
3940
}
4041
}

src/test/java/org/eclipse/yasson/defaultmapping/specific/UnmarshallingUnsupportedTypesTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void setValue(String value) {
7272
String expected = "{\"customInterface\":{\"value\":\"value1\"}}";
7373
assertEquals(expected, defaultJsonb.toJson(unsupported));
7474
try {
75-
defaultJsonb.fromJson(expected, ClassWithUnsupportedFields.class);
75+
defaultJsonb.fromJson(expected, ClassWithUnsupportedFields.class);
7676
fail("Should report an error");
7777
} catch (JsonbException e) {
7878
assertTrue(e.getMessage().contains("Cannot infer a type"));
@@ -136,11 +136,11 @@ public void testMissingFieldDefaultNull() {
136136

137137
@Test
138138
public void testMissingFieldIgnored() {
139-
assertThrows(JsonbException.class, () -> {
140-
Jsonb defaultConfig = JsonbBuilder.create(new JsonbConfig().setProperty(FAIL_ON_UNKNOWN_PROPERTIES, true));
141-
String json = "{\"nestedPojo\":{\"integerValue\":10,\"missingField\":5},\"optionalLong\":11}";
142-
SupportedTypes result = defaultConfig.fromJson(json, SupportedTypes.class);
143-
});
139+
assertThrows(JsonbException.class, () -> {
140+
Jsonb defaultConfig = JsonbBuilder.create(new JsonbConfig().setProperty(FAIL_ON_UNKNOWN_PROPERTIES, true));
141+
String json = "{\"nestedPojo\":{\"integerValue\":10,\"missingField\":5},\"optionalLong\":11}";
142+
SupportedTypes result = defaultConfig.fromJson(json, SupportedTypes.class);
143+
});
144144
}
145145

146146
@Test
@@ -229,19 +229,19 @@ public void testEmptyStringAsOptionalLong() {
229229

230230
@Test
231231
public void testMalformedURL() {
232-
Type type = new TestTypeToken<ScalarValueWrapper<URL>>(){}.getType();
233-
assertFail("{\"value\":\"www.oracle.com\"}", type, "value", URL.class);
232+
Type type = new TestTypeToken<ScalarValueWrapper<URL>>(){}.getType();
233+
assertFail("{\"value\":\"www.oracle.com\"}", type, "value", URL.class);
234234
}
235235

236236
@Test
237237
public void testMalformedURI() {
238-
Type type = new TestTypeToken<ScalarValueWrapper<URI>>(){}.getType();
239-
assertFail("{\"value\":\"www .oracle .com\"}", type, "value", URI.class);
238+
Type type = new TestTypeToken<ScalarValueWrapper<URI>>(){}.getType();
239+
assertFail("{\"value\":\"www .oracle .com\"}", type, "value", URI.class);
240240
}
241241

242242
private void assertFail(String json, Type type, String failureProperty, Class<?> failurePropertyClass) {
243243
try {
244-
defaultJsonb.fromJson(json, type);
244+
defaultJsonb.fromJson(json, type);
245245
fail("Expected to catch JsonbException but did not");
246246
} catch (JsonbException e) {
247247
if(!e.getMessage().contains(failureProperty) || !e.getMessage().contains(failurePropertyClass.getName())) {

0 commit comments

Comments
 (0)