From c02bda5b0c4374e58355b5927c95dadb9b731352 Mon Sep 17 00:00:00 2001 From: Pascal Essiembre Date: Fri, 30 Aug 2024 22:44:50 -0400 Subject: [PATCH] minor formatting --- .../bean/jackson/JsonXmlMapSerializer.java | 10 +- .../commons/lang/time/DurationFormatter.java | 2 +- .../commons/lang/xml/XmlFormatter.java | 2 +- .../lang/bean/jackson/JsonXmlMapTest.java | 14 +-- .../commons/lang/url/HttpURLTest.java | 114 +++++++++--------- 5 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapSerializer.java b/src/main/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapSerializer.java index 3d1ac895..9cbbc942 100644 --- a/src/main/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapSerializer.java +++ b/src/main/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapSerializer.java @@ -58,7 +58,7 @@ private JsonXmlMapSerializer(BeanProperty currentProperty) { @Override public StdSerializer createContextual( SerializerProvider prov, BeanProperty property) - throws JsonMappingException { + throws JsonMappingException { return new JsonXmlMapSerializer<>(property); } @@ -84,12 +84,12 @@ public void serialize( entryName = DEFAULT_ENTRY_NAME; } } - gen.writeStartObject(); // outter name + gen.writeStartObject(); // outter name for (Map.Entry entry : map.entrySet()) { gen.writeFieldName(entryName); - gen.writeStartObject(); // + gen.writeStartObject(); // // Write key gen.writeFieldName(keyName); @@ -100,8 +100,8 @@ public void serialize( provider.defaultSerializeValue(entry.getValue(), gen); // Close the entry element manually - gen.writeEndObject(); // + gen.writeEndObject(); // } - gen.writeEndObject(); // + gen.writeEndObject(); // } } diff --git a/src/main/java/com/norconex/commons/lang/time/DurationFormatter.java b/src/main/java/com/norconex/commons/lang/time/DurationFormatter.java index 957fe22d..b50ea190 100644 --- a/src/main/java/com/norconex/commons/lang/time/DurationFormatter.java +++ b/src/main/java/com/norconex/commons/lang/time/DurationFormatter.java @@ -62,7 +62,7 @@ public final class DurationFormatter { * Creates a duration with the default locale and full words for * duration units. */ - public DurationFormatter() { //NOSONAR Exists for javadoc + public DurationFormatter() { //NOSONAR Exists for javadoc } /** diff --git a/src/main/java/com/norconex/commons/lang/xml/XmlFormatter.java b/src/main/java/com/norconex/commons/lang/xml/XmlFormatter.java index b66260ed..da64805a 100644 --- a/src/main/java/com/norconex/commons/lang/xml/XmlFormatter.java +++ b/src/main/java/com/norconex/commons/lang/xml/XmlFormatter.java @@ -307,7 +307,7 @@ private boolean writeAttributes(Appendable w, String margin) case AT_MAX_ALL: yield writeAttribsWrapAtMaxAll(w, margin); default: // ALL - { + { writeAttribsWarpAll(w, margin); yield true; } diff --git a/src/test/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapTest.java b/src/test/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapTest.java index b2e1d244..4d22383b 100644 --- a/src/test/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapTest.java +++ b/src/test/java/com/norconex/commons/lang/bean/jackson/JsonXmlMapTest.java @@ -46,13 +46,13 @@ static void beforeAll() { ch = new MapHolder(); ch.some = "thing"; ch.defaultEntryNames.putAll(MapUtil.toMap("k1", "v1", "k2", "v2")); - ch.specifiedEntryNames = new LinkedMap<>(MapUtil.toMap("k3", "v3", "k4", "v4")); + ch.specifiedEntryNames = + new LinkedMap<>(MapUtil.toMap("k3", "v3", "k4", "v4")); ch.defaultType = new HashMap<>(MapUtil.toMap(5, true, 6, false)); ch.complexType.putAll(MapUtil.toMap( new SomeKey("k7-a", "k7-b"), new SomeValue("v7-a", "b7-b"), new SomeKey("k8-a", "k8-b"), new SomeValue("v8-a", "b8-b"), - new SomeKey("k9-a", "k9-b"), new SomeValue("v9-a", "b9-b") - )); + new SomeKey("k9-a", "k9-b"), new SomeValue("v9-a", "b9-b"))); } @Test @@ -95,9 +95,10 @@ static class MapHolder { private final Map defaultEntryNames = new TreeMap<>(); @JsonXmlMap( - entryName = "child", - keyName = "childKey", - valueName = "childValue") + entryName = "child", + keyName = "childKey", + valueName = "childValue" + ) private Map specifiedEntryNames; private Map defaultType; @@ -123,7 +124,6 @@ public static class SomeValue { private String propd; } - @Data @JsonInclude(value = Include.ALWAYS, content = Include.ALWAYS) static class ObjectWithNullMap { diff --git a/src/test/java/com/norconex/commons/lang/url/HttpURLTest.java b/src/test/java/com/norconex/commons/lang/url/HttpURLTest.java index 7178b172..caf05df5 100644 --- a/src/test/java/com/norconex/commons/lang/url/HttpURLTest.java +++ b/src/test/java/com/norconex/commons/lang/url/HttpURLTest.java @@ -43,49 +43,49 @@ void tearDown() throws Exception { @ParameterizedTest @CsvSource( value = { - """ - Keep protocol character case,\ - HTTP://www.example.com,\ + """ + Keep protocol character case,\ + HTTP://www.example.com,\ HTTP://www.example.com""", - """ - 'http' protocol without port,\ - http://www.example.com/blah,\ + """ + 'http' protocol without port,\ + http://www.example.com/blah,\ http://www.example.com/blah""", - """ - 'http' protocol with default port,\ - http://www.example.com:80/blah,\ + """ + 'http' protocol with default port,\ + http://www.example.com:80/blah,\ http://www.example.com/blah""", - """ - 'http' protocol with non-default port,\ - http://www.example.com:81/blah,\ + """ + 'http' protocol with non-default port,\ + http://www.example.com:81/blah,\ http://www.example.com:81/blah""", - """ - 'https' protocol without port,\ - https://www.example.com/blah,\ + """ + 'https' protocol without port,\ + https://www.example.com/blah,\ https://www.example.com/blah""", - """ - 'https' protocol with default port,\ - https://www.example.com:443/blah,\ + """ + 'https' protocol with default port,\ + https://www.example.com:443/blah,\ https://www.example.com/blah""", - """ - 'https' protocol with non-default port,\ - https://www.example.com:444/blah,\ + """ + 'https' protocol with non-default port,\ + https://www.example.com:444/blah,\ https://www.example.com:444/blah""", - """ - Non 'http(s)' protocol without port,\ - ftp://ftp.example.com/dir,\ + """ + Non 'http(s)' protocol without port,\ + ftp://ftp.example.com/dir,\ ftp://ftp.example.com/dir""", - """ - Non 'http(s)' protocol with port,\ - ftp://ftp.example.com:20/dir,\ + """ + Non 'http(s)' protocol with port,\ + ftp://ftp.example.com:20/dir,\ ftp://ftp.example.com:20/dir""", - """ - Invalid URL,\ - http://www.example.com/"path",\ + """ + Invalid URL,\ + http://www.example.com/"path",\ http://www.example.com/%22path%22""", - """ - URL with leading or trailing spaces,\ - http://www.example.com/path ,\ + """ + URL with leading or trailing spaces,\ + http://www.example.com/path ,\ http://www.example.com/path""", }, ignoreLeadingAndTrailingWhitespace = false @@ -101,37 +101,37 @@ void testURLToStringEquals( @ParameterizedTest @CsvSource( value = { - """ - Relative to protocol,\ - //www.relative.com/e/f.html,\ + """ + Relative to protocol,\ + //www.relative.com/e/f.html,\ https://www.relative.com/e/f.html""", - """ - Relative to domain name,\ - /e/f.html,\ + """ + Relative to domain name,\ + /e/f.html,\ https://www.example.com/e/f.html""", - """ - Relative to full page URL,\ - ?name=john,\ + """ + Relative to full page URL,\ + ?name=john,\ https://www.example.com/a/b/c.html?name=john""", - """ - Relative to last directory,\ - g.html,\ + """ + Relative to last directory,\ + g.html,\ https://www.example.com/a/b/g.html""", - """ - Absolute URL,\ - http://www.sample.com/xyz.html,\ + """ + Absolute URL,\ + http://www.sample.com/xyz.html,\ http://www.sample.com/xyz.html""", - """ - Relative with colon in parameter,\ - h/i.html?param=1:2,\ + """ + Relative with colon in parameter,\ + h/i.html?param=1:2,\ https://www.example.com/a/b/h/i.html?param=1:2""", - """ - Starts with valid odd scheme,\ - x1+2-3.4:yz,\ + """ + Starts with valid odd scheme,\ + x1+2-3.4:yz,\ x1+2-3.4:yz""", - """ - Starts with invalid odd scheme,\ - 1+2-3.4x:yz,\ + """ + Starts with invalid odd scheme,\ + 1+2-3.4x:yz,\ https://www.example.com/a/b/1+2-3.4x:yz""", }, ignoreLeadingAndTrailingWhitespace = false