You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2006/04/26 22:58:10 UTC
svn commit: r397300 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
Author: kmarsden
Date: Wed Apr 26 13:58:09 2006
New Revision: 397300
URL: http://svn.apache.org/viewcvs?rev=397300&view=rev
Log:
DERBY-1247 - Make DerbyNetAutostart encoding safe
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java?rev=397300&r1=397299&r2=397300&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java Wed Apr 26 13:58:09 2006
@@ -31,6 +31,8 @@
import java.io.IOException;
import java.io.FileOutputStream;
import java.io.ByteArrayOutputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
@@ -386,7 +388,7 @@
stopServer( serverProcess);
return;
}
- if( !checkLog( logFile, new String[] {"An exception was thrown during network server startup"}))
+ if( !checkLog( logFileName, new String[] {"An exception was thrown during network server startup"}))
{
// Was the network server started? Print out the names of the threads
System.out.println( "Active threads:");
@@ -466,13 +468,15 @@
serverProcess.destroy();
} // end of stopServer
- private static boolean checkLog( RandomAccessFile logFile, String[] expected) throws IOException
+ private static boolean checkLog( String logFileName, String[] expected) throws IOException
{
boolean allFound = true;
boolean[] found = new boolean[ expected.length];
- while( logFile.getFilePointer() < logFile.length())
+ FileInputStream is = new FileInputStream(logFileName);
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ String logLine;
+ while((logLine = br.readLine()) != null)
{
- String logLine = logFile.readLine();
for( int i = 0; i < expected.length; i++)
{
if( (! found[i]) && logLine.indexOf( expected[i]) >= 0)