tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1640898 - in /tomcat/tc7.0.x/trunk: ./ test/org/apache/tomcat/util/buf/TestUtf8.java
Date Fri, 21 Nov 2014 11:26:07 GMT
Author: kkolinko
Date: Fri Nov 21 11:26:07 2014
New Revision: 1640898

URL: http://svn.apache.org/r1640898
Log:
Backport TestUtf8 fixes from Tomcat 8,
to enable Apache Gump to run Tomcat 7 tests with Java 8. I tested this with Java 6 and 7 as
well.

Merged r1593421 from tomcat/tc8.0.x/trunk:
Testing with Java 9 early access.
UTF-8 issues resolved.

Merged r1636525 from tomcat/tc8.0.x/trunk:
Update UTF-8 test to take account of recent(ish) Java 8 fixes for UTF-8.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUtf8.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1593421,1636524
  Merged /tomcat/tc8.0.x/trunk:r1636525

Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUtf8.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUtf8.java?rev=1640898&r1=1640897&r2=1640898&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUtf8.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUtf8.java Fri Nov 21 11:26:07
2014
@@ -60,8 +60,8 @@ public class TestUtf8 {
     private static int workAroundCount = 0;
 
     static {
-        // Future proof test and assume some UTF-8 bugs won't get fixed until
-        // Java 9 or later
+        // All known issues have been fixed in Java 8
+        // https://bugs.openjdk.java.net/browse/JDK-8039751
         // Base assumption in Java 7
         int javaVersion = 7;
         try {
@@ -70,6 +70,7 @@ public class TestUtf8 {
         } catch (Exception e) {
             // Ignore
         }
+
         Utf8TestCase testCase = null;
 
         TEST_CASES.add(new Utf8TestCase(
@@ -97,12 +98,17 @@ public class TestUtf8 {
                 new int[] {0xF0, 0x90, 0x90, 0x80},
                 -1,
                 "\uD801\uDC00"));
-        // JVM decoder does not report error until all 4 bytes are available
-        TEST_CASES.add(new Utf8TestCase(
+        // Java 7 JVM decoder does not report error until all 4 bytes are
+        // available
+        testCase = new Utf8TestCase(
                 "Invalid code point - out of range",
                 new int[] {0x41, 0xF4, 0x90, 0x80, 0x80, 0x41},
                 2,
-                "A\uFFFD\uFFFD\uFFFD\uFFFDA").addForJvm(ERROR_POS_PLUS2));
+                "A\uFFFD\uFFFD\uFFFD\uFFFDA");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
 
         // Java 7 JVM decoder does not report error until all 2 bytes are available
         testCase = new Utf8TestCase(
@@ -126,12 +132,18 @@ public class TestUtf8 {
         }
         TEST_CASES.add(testCase);
 
-        // JVM decoder does not report error until all 4 bytes are available
-        TEST_CASES.add(new Utf8TestCase(
+        // Java 7 JVM decoder does not report error until all 4 bytes are
+        // available
+        testCase = new Utf8TestCase(
                 "Valid sequence padded from one byte to four",
                 new int[] {0x41, 0xF0, 0x80, 0x80, 0xC1, 0x41},
                 2,
-                "A\uFFFD\uFFFD\uFFFD\uFFFDA").addForJvm(ERROR_POS_PLUS2));
+                "A\uFFFD\uFFFD\uFFFD\uFFFDA");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
+
         TEST_CASES.add(new Utf8TestCase(
                 "Invalid one byte 1111 1111",
                 new int[] {0x41, 0xFF, 0x41},
@@ -334,26 +346,46 @@ public class TestUtf8 {
                 new int[] {0x61, 0xE1, 0x80, 0xC0, 0x61},
                 3,
                 "a\uFFFD\uFFFDa"));
-        TEST_CASES.add(new Utf8TestCase(
+        testCase = new Utf8TestCase(
                 "Four bytes, U+0000 zero-padded",
                 new int[] {0x61, 0xF0, 0x80, 0x80, 0x80, 0x61},
                 2,
-                "a\uFFFD\uFFFD\uFFFD\uFFFDa").addForJvm(ERROR_POS_PLUS2));
-        TEST_CASES.add(new Utf8TestCase(
+                "a\uFFFD\uFFFD\uFFFD\uFFFDa");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
+
+        testCase = new Utf8TestCase(
                 "Four bytes, U+007F zero-padded",
                 new int[] {0x61, 0xF0, 0x80, 0x81, 0xBF, 0x61},
                 2,
-                "a\uFFFD\uFFFD\uFFFD\uFFFDa").addForJvm(ERROR_POS_PLUS2));
-        TEST_CASES.add(new Utf8TestCase(
+                "a\uFFFD\uFFFD\uFFFD\uFFFDa");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
+
+        testCase = new Utf8TestCase(
                 "Four bytes, U+07FF zero-padded",
                 new int[] {0x61, 0xF0, 0x80, 0x9F, 0xBF, 0x61},
                 2,
-                "a\uFFFD\uFFFD\uFFFD\uFFFDa").addForJvm(ERROR_POS_PLUS2));
-        TEST_CASES.add(new Utf8TestCase(
+                "a\uFFFD\uFFFD\uFFFD\uFFFDa");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
+
+        testCase = new Utf8TestCase(
                 "Four bytes, U+FFFF zero-padded",
                 new int[] {0x61, 0xF0, 0x8F, 0xBF, 0xBF, 0x61},
                 2,
-                "a\uFFFD\uFFFD\uFFFD\uFFFDa").addForJvm(ERROR_POS_PLUS2));
+                "a\uFFFD\uFFFD\uFFFD\uFFFDa");
+        if (javaVersion < 8) {
+            testCase.addForJvm(ERROR_POS_PLUS2);
+        }
+        TEST_CASES.add(testCase);
+
         TEST_CASES.add(new Utf8TestCase(
                 "Four bytes, all 1's",
                 new int[] {0x61, 0xFF, 0xFF, 0xFF, 0xFF, 0x61},



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


Mime
View raw message