1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

fix for bug 333874

This commit is contained in:
Xuan Chen 2011-02-01 21:30:24 +00:00
parent 71303a646b
commit 4a18f780de

View file

@ -350,6 +350,8 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
*/ */
public boolean compareContent1(InputStream a, InputStream b) { public boolean compareContent1(InputStream a, InputStream b) {
int c, d; int c, d;
StringBuilder bufferA = new StringBuilder(100);
StringBuilder bufferB = new StringBuilder(100);
if (a == null && b == null) if (a == null && b == null)
return true; return true;
try { try {
@ -359,13 +361,15 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
return false; return false;
} }
while ((c = a.read()) == (d = b.read()) && (c != -1 && d != -1)) { while ((c = a.read()) == (d = b.read()) && (c != -1 && d != -1)) {
//body not needed //remember the read value to string buffer
bufferA.append(c);
bufferB.append(d);
} }
if (c == -1 && d == -1) if (c == -1 && d == -1)
{ {
return true; return true;
} }
String msg = "difference: c is: " + c + " but d is: " + d + " a is: " + a.toString() + " but b is: " + b.toString(); String msg = "difference: c is: " + c + " but d is: " + d + " a so far is: " + bufferA.toString() + " but b so far is: " + bufferB.toString();
fail(msg); fail(msg);
return false; return false;
} catch (IOException e) { } catch (IOException e) {