Merge branch '5.3.x'

This commit is contained in:
Brian Clozel 2021-11-16 15:05:24 +01:00
commit f3b83e7ad4
2 changed files with 7 additions and 7 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 && boolean isPotentialReference = (this.nextPotentialReferencePosition != -1 &&
this.nextSemicolonPosition != -1 && this.nextSemicolonPosition != -1 &&
this.nextPotentialReferencePosition - this.nextSemicolonPosition < MAX_REFERENCE_SIZE); this.nextSemicolonPosition - this.nextPotentialReferencePosition < MAX_REFERENCE_SIZE);
if (isPotentialReference) { if (isPotentialReference) {
break; break;

View File

@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class HtmlUtilsTests { public class HtmlUtilsTests {
@Test @Test
public void testHtmlEscape() { void testHtmlEscape() {
String unescaped = "\"This is a quote'"; String unescaped = "\"This is a quote'";
String escaped = HtmlUtils.htmlEscape(unescaped); String escaped = HtmlUtils.htmlEscape(unescaped);
assertThat(escaped).isEqualTo("&quot;This is a quote&#39;"); assertThat(escaped).isEqualTo("&quot;This is a quote&#39;");
@ -39,14 +39,14 @@ public class HtmlUtilsTests {
} }
@Test @Test
public void testHtmlUnescape() { void testHtmlUnescape() {
String escaped = "&quot;This is a quote&#39;"; String escaped = "&quot;This is a quote&#39;";
String unescaped = HtmlUtils.htmlUnescape(escaped); String unescaped = HtmlUtils.htmlUnescape(escaped);
assertThat(unescaped).isEqualTo("\"This is a quote'"); assertThat(unescaped).isEqualTo("\"This is a quote'");
} }
@Test @Test
public void testEncodeIntoHtmlCharacterSet() { void testEncodeIntoHtmlCharacterSet() {
assertThat(HtmlUtils.htmlEscape("")).as("An empty string should be converted to an empty string").isEqualTo(""); 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."); 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 // SPR-9293
@Test @Test
public void testEncodeIntoHtmlCharacterSetFromUtf8() { void testEncodeIntoHtmlCharacterSetFromUtf8() {
String utf8 = ("UTF-8"); String utf8 = ("UTF-8");
assertThat(HtmlUtils.htmlEscape("", utf8)).as("An empty string should be converted to an empty string").isEqualTo(""); 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."); 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 @Test
public void testDecodeFromHtmlCharacterSet() { void testDecodeFromHtmlCharacterSet() {
assertThat(HtmlUtils.htmlUnescape("")).as("An empty string should be converted to an empty string").isEqualTo(""); 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."); 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.");