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

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new b2a589a  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63831
b2a589a is described below

commit b2a589a94f21c1e461b4f98157551669a1691a62
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 24 18:18:33 2019 +0200

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63831
    
    Make test pass on any locale
---
 test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java 
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index c1c0702..2157eae 100644
--- a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
+++ b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -85,6 +86,10 @@ public class TestHttp2InitialConnection extends 
Http2TestBase {
         request.append("\r\n");
         // Settings
         request.append(settings);
+        // Locale - Force the en Locale else the i18n on the error page changes
+        // the size of the response body and that triggers a failure as the 
test
+        // checks the exact response length
+        request.append("Accept-Language: en\r\n");
         // Request terminator
         request.append("\r\n");
 
@@ -117,7 +122,8 @@ public class TestHttp2InitialConnection extends 
Http2TestBase {
              * Note: The status header appears twice in the error page.
              */
             int serverInfoLength = 
ServerInfo.getServerInfo().getBytes().length;
-            StringManager sm = 
StringManager.getManager(ErrorReportValve.class);
+            StringManager sm = StringManager.getManager(
+                    ErrorReportValve.class.getPackage().getName(), 
Locale.ENGLISH);
             int statusHeaderLength = sm
                     .getString("errorReportValve.statusHeader", "", "")
                     .getBytes(StandardCharsets.UTF_8).length;
@@ -125,7 +131,7 @@ public class TestHttp2InitialConnection extends 
Http2TestBase {
             String contentLength = String.valueOf(len);
             return getResponseBodyFrameTrace(streamId,
                     testData.getExpectedStatus(), "text/html;charset=utf-8",
-                    sm.getLocale().getLanguage(), contentLength, 
contentLength);
+                    "en", contentLength, contentLength);
         } else {
             Assert.fail();
             // To keep the IDE happy


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

Reply via email to