You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2019/05/05 14:32:10 UTC

[tomcat] branch master updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63403

This is an automated email from the ASF dual-hosted git repository.

kkolinko 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 1758f64  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63403
1758f64 is described below

commit 1758f6460a8e8fbf38b88385860379a4424cc66b
Author: Konstantin Kolinko <kk...@apache.org>
AuthorDate: Sun May 5 17:13:48 2019 +0300

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63403
    
    Fix TestHttp2InitialConnection test failures on a non-English PC.
    
    1. The language was hard-coded as "en".
    2. The length check was off, as String.getBytes() uses OS default code page, but the actual response is in UTF-8.
---
 test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 10 ++++++----
 webapps/docs/changelog.xml                                   |  4 ++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index 61a9fbd..c1c0702 100644
--- a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
+++ b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
@@ -118,12 +118,14 @@ public class TestHttp2InitialConnection extends Http2TestBase {
              */
             int serverInfoLength = ServerInfo.getServerInfo().getBytes().length;
             StringManager sm = StringManager.getManager(ErrorReportValve.class);
-            int statusHeaderLength = sm.getString(
-                    "errorReportValve.statusHeader", "", "").getBytes().length;
+            int statusHeaderLength = sm
+                    .getString("errorReportValve.statusHeader", "", "")
+                    .getBytes(StandardCharsets.UTF_8).length;
             int len = 1073 + serverInfoLength + statusHeaderLength * 2;
             String contentLength = String.valueOf(len);
-            return getResponseBodyFrameTrace(streamId, testData.getExpectedStatus(),
-                    "text/html;charset=utf-8", "en", contentLength, contentLength);
+            return getResponseBodyFrameTrace(streamId,
+                    testData.getExpectedStatus(), "text/html;charset=utf-8",
+                    sm.getLocale().getLanguage(), contentLength, contentLength);
         } else {
             Assert.fail();
             // To keep the IDE happy
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1d486af..872b5c4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -61,6 +61,10 @@
         Start Graal native image compatibility. Support is initially targeted
         at the tomcat-maven packaging. (remm)
       </update>
+      <fix>
+        <bug>63403</bug>: Fix TestHttp2InitialConnection test failures when
+        running with a non-English locale. (kkolinko)
+      </fix>
     </changelog>
   </subsection>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org