diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java index 2277edfff3a..2d6db518b20 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java +++ b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ class HtmlCharacterEntityDecoder { boolean isPotentialReference = (this.nextPotentialReferencePosition != -1 && this.nextSemicolonPosition != -1 && - this.nextPotentialReferencePosition - this.nextSemicolonPosition < MAX_REFERENCE_SIZE); + this.nextSemicolonPosition - this.nextPotentialReferencePosition < MAX_REFERENCE_SIZE); if (isPotentialReference) { break; diff --git a/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java index 68d31898f54..232a436e503 100644 --- a/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class HtmlUtilsTests { @Test - public void testHtmlEscape() { + void testHtmlEscape() { String unescaped = "\"This is a quote'"; String escaped = HtmlUtils.htmlEscape(unescaped); assertThat(escaped).isEqualTo(""This is a quote'"); @@ -39,14 +39,14 @@ public class HtmlUtilsTests { } @Test - public void testHtmlUnescape() { + void testHtmlUnescape() { String escaped = ""This is a quote'"; String unescaped = HtmlUtils.htmlUnescape(escaped); assertThat(unescaped).isEqualTo("\"This is a quote'"); } @Test - public void testEncodeIntoHtmlCharacterSet() { + void testEncodeIntoHtmlCharacterSet() { assertThat(HtmlUtils.htmlEscape("")).as("An empty string should be converted to an empty string").isEqualTo(""); assertThat(HtmlUtils.htmlEscape("A sentence containing no special characters.")).as("A string containing no special characters should not be affected").isEqualTo("A sentence containing no special characters."); @@ -62,7 +62,7 @@ public class HtmlUtilsTests { // SPR-9293 @Test - public void testEncodeIntoHtmlCharacterSetFromUtf8() { + void testEncodeIntoHtmlCharacterSetFromUtf8() { String utf8 = ("UTF-8"); assertThat(HtmlUtils.htmlEscape("", utf8)).as("An empty string should be converted to an empty string").isEqualTo(""); assertThat(HtmlUtils.htmlEscape("A sentence containing no special characters.")).as("A string containing no special characters should not be affected").isEqualTo("A sentence containing no special characters."); @@ -74,7 +74,7 @@ public class HtmlUtilsTests { } @Test - public void testDecodeFromHtmlCharacterSet() { + void testDecodeFromHtmlCharacterSet() { assertThat(HtmlUtils.htmlUnescape("")).as("An empty string should be converted to an empty string").isEqualTo(""); assertThat(HtmlUtils.htmlUnescape("This is a sentence containing no special characters.")).as("A string containing no special characters should not be affected").isEqualTo("This is a sentence containing no special characters.");