This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new a9ac9c0 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63830 a9ac9c0 is described below commit a9ac9c0cd4c63106667a9af8a332dc4d2dc1389b Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Oct 23 12:15:05 2019 +0200 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63830 Ensure this unit test passes when running on system using a locale that uses a language other than English. --- test/org/apache/coyote/http2/TestHttp2Limits.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java b/test/org/apache/coyote/http2/TestHttp2Limits.java index 2a9ba74..d5f109f 100644 --- a/test/org/apache/coyote/http2/TestHttp2Limits.java +++ b/test/org/apache/coyote/http2/TestHttp2Limits.java @@ -31,9 +31,12 @@ import org.junit.Test; import org.apache.catalina.connector.Connector; import org.apache.coyote.http2.HpackEncoder.State; import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.tomcat.util.res.StringManager; public class TestHttp2Limits extends Http2TestBase { + private static final StringManager sm = StringManager.getManager(TestHttp2Limits.class); + @Test public void testHeaderLimits1x128() throws Exception { // Well within limits @@ -247,6 +250,12 @@ public class TestHttp2Limits extends Http2TestBase { break; } case CONNECTION_RESET: { + // This message uses i18n and needs to be used in a regular + // expression (since we don't know the connection ID). Generate the + // string as a regular expression and then replace '[' and ']' with + // the escaped values. + String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\d++", "3"); + limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]"); // Connection reset. Connection ID will vary so use a pattern // On some platform / Connector combinations (e.g. Windows / APR), // the TCP connection close will be processed before the client gets @@ -257,7 +266,7 @@ public class TestHttp2Limits extends Http2TestBase { try { parser.readFrame(true); Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex( - "0-Goaway-\\[1\\]-\\[11\\]-\\[Connection \\[\\d++\\], Stream \\[3\\], .*")); + "0-Goaway-\\[1\\]-\\[11\\]-\\[" + limitMessage + "\\]")); } catch (IOException se) { // Expected on some platforms } @@ -490,9 +499,14 @@ public class TestHttp2Limits extends Http2TestBase { // NIO2 can sometimes send window updates depending timing skipWindowSizeFrames(); - // Connection ID will vary so use a pattern + // This message uses i18n and needs to be used in a regular + // expression (since we don't know the connection ID). Generate the + // string as a regular expression and then replace '[' and ']' with + // the escaped values. + String limitMessage = sm.getString("http2Parser.headerLimitSize", "\\d++", "3"); + limitMessage = limitMessage.replace("[", "\\[").replace("]", "\\]"); Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex( - "0-Goaway-\\[3\\]-\\[11\\]-\\[Connection \\[\\d++\\], Stream \\[3\\], .*")); + "0-Goaway-\\[3\\]-\\[11\\]-\\[" + limitMessage + "\\]")); break; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org