db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r608140 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Date Wed, 02 Jan 2008 16:38:27 GMT
Author: myrnavl
Date: Wed Jan  2 08:38:26 2008
New Revision: 608140

URL: http://svn.apache.org/viewvc?rev=608140&view=rev
Log:
DERBY-3250 : making NetworkServerTestSetup using a Runtime.exec(String[]) rather than Runtime.exec(String)
to prevent trouble with spaces in arguments.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=608140&r1=608139&r2=608140&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Wed Jan  2 08:38:26 2008
@@ -184,22 +184,21 @@
 
     private Process startSeparateProcess() throws Exception
     {
-        StringBuffer    buffer = new StringBuffer();
+        ArrayList       al = new ArrayList();
         String              classpath = BaseTestCase.getSystemProperty( "java.class.path"
);
         boolean         skipHostName = false;
 
-        buffer.append( "java -classpath " );
-        buffer.append( classpath );
-        buffer.append( " " );
+        al.add( "java" );
+        al.add( "-classpath" );
+        al.add( classpath );
 
         int         count = systemProperties.length;
         for ( int i = 0; i < count; i++ )
         {
-            buffer.append( " -D" );
-            buffer.append( systemProperties[ i ] );
+            al.add( "-D" + systemProperties[ i ] );
         }
 
-        buffer.append( " org.apache.derby.drda.NetworkServerControl " );
+        al.add( "org.apache.derby.drda.NetworkServerControl" );
 
         count = startupArgs.length;
         for ( int i = 0; i < count; i++ )
@@ -214,20 +213,24 @@
         count = defaultArgs.length;
         for ( int i = 0; i < count; i++ )
         {
-            buffer.append( " " );
-            buffer.append( defaultArgs[ i ] );
+            al.add( defaultArgs[ i ] );
         }
 
         count = startupArgs.length;
         for ( int i = 0; i < count; i++ )
         {
-            buffer.append( " " );
-            buffer.append( startupArgs[ i ] );
+            al.add( startupArgs[ i ] );
         }
 
-        final   String  command = buffer.toString();
+        final   String[]  command = new String[ al.size() ];
+        al.toArray(command);
 
-        //System.out.println( "XXX server startup command = " + command );
+        /* System.out.println( "XXX server startup command = ");
+        for (int i = 0 ; i < command.length ; i++) {
+            System.out.print( command[i] + " " );
+        }
+        System.out.println();
+        */
 
         Process     serverProcess = (Process) AccessController.doPrivileged
             (



Mime
View raw message