flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hshreedha...@apache.org
Subject flume git commit: FLUME-2538. TestResettableFileInputStream fails on JDK 8.
Date Thu, 13 Nov 2014 23:24:34 GMT
Repository: flume
Updated Branches:
  refs/heads/flume-1.6 fec1bbc7e -> c53339c02


FLUME-2538. TestResettableFileInputStream fails on JDK 8.

(Johny Rufus via Hari)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/c53339c0
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/c53339c0
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/c53339c0

Branch: refs/heads/flume-1.6
Commit: c53339c028b8d30cf42b208dc259cf61375bbfd5
Parents: fec1bbc
Author: Hari Shreedharan <hshreedharan@apache.org>
Authored: Thu Nov 13 15:23:37 2014 -0800
Committer: Hari Shreedharan <hshreedharan@apache.org>
Committed: Thu Nov 13 15:24:22 2014 -0800

----------------------------------------------------------------------
 .../serialization/TestResettableFileInputStream.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/c53339c0/flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
b/flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
index 73df9c9..d1240fb 100644
--- a/flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
+++ b/flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
@@ -139,8 +139,16 @@ public class TestResettableFileInputStream {
     while ((c = in.readChar()) != -1) {
       sb.append((char)c);
     }
-    assertEquals("Latin1: (X)\nLong: (XXX)\nNonUnicode: (X)\n"
-        .replaceAll("X", "\ufffd"), sb.toString());
+    String preJdk8ExpectedStr = "Latin1: (X)\nLong: (XXX)\nNonUnicode: (X)\n";
+    String expectedStr = "Latin1: (X)\nLong: (XXX)\nNonUnicode: (XXXXX)\n";
+    String javaVersionStr = System.getProperty("java.version");
+    double javaVersion = Double.parseDouble(javaVersionStr.substring(0, 3));
+
+    if(javaVersion < 1.8) {
+      assertTrue(preJdk8ExpectedStr.replaceAll("X", "\ufffd").equals(sb.toString()));
+    } else {
+      assertTrue(expectedStr.replaceAll("X", "\ufffd").equals(sb.toString()));
+    }
   }
 
   @Test(expected = MalformedInputException.class)


Mime
View raw message