db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r170880 - in /incubator/derby/code/trunk/java/testing: README.htm org/apache/derbyTesting/functionTests/harness/Sed.java
Date Thu, 19 May 2005 06:12:38 GMT
Author: fuzzylogic
Date: Wed May 18 23:12:37 2005
New Revision: 170880

URL: http://svn.apache.org/viewcvs?rev=170880&view=rev
Log:
Clean up Sed.java and add more information to README.htm

Committed for Myrna Van Lunteran <m.v.lunteran@gmail.com>

Modified:
    incubator/derby/code/trunk/java/testing/README.htm
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java

Modified: incubator/derby/code/trunk/java/testing/README.htm
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/README.htm?rev=170880&r1=170879&r2=170880&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/README.htm (original)
+++ incubator/derby/code/trunk/java/testing/README.htm Wed May 18 23:12:37 2005
@@ -117,6 +117,8 @@
   </tbody>
 </table>
 <ul>
+  <li>cd into a directory that does not have any colons or spaces in it.<br>
+  </li>
   <li>set $CLASSPATH to include the following jars:</li>
   <ul>
     <li><small>jakarta-oro-2.0.8.jar</small></li>
@@ -520,8 +522,15 @@
     </tr>
   </tbody>
 </table>
-<p>Once you have built the derbyTesting package built, you can make a
-derbyTesting.jar use the jar build target at the ${derby.source}level.
+<p>Building using the ant all target places all files, that is,
+classes, but also supporting files such as expected output (*.out), sql
+test files (*.sql), properties files and any data files used in
+individual tests into the classes directory so they can all be found
+using the CLASSPATH. <br>
+</p>
+<p>Once you have built the derbyTesting package, you can make a
+derbyTesting.jar using the jar build target at the
+${derby.source}level.
 </p>
 <p>
 This will look something like:
@@ -1100,7 +1109,6 @@
 To skip a test when running with any version of the IBM Universal
 Driver that is 2.0 or later:<br>
 excludeJCC=at-or-after:2.0<br>
-</>
 <p>You can also specify an (optional) jvm clause to further tune the
 exclusion criteria.&nbsp; This clause starts with the "<span
  style="font-weight: bold;">,when</span>" tag and is followed by a
@@ -1174,8 +1182,15 @@
 TestSpecialFlags<br>
 &nbsp;&nbsp;&nbsp; sets additional properties.<br>
 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; java
--D=TestSpecialFlags=derby.infolog.append=true
+-DTestSpecialFlags=derby.infolog.append=true
 org.apache.derbyTesting.functionTests.RunTest lang/arithmetic.sql <br>
+jvmflags<br>
+&nbsp;&nbsp;&nbsp; sets specific jvm properties for the jvm used in the test
harness, for
+instance initial memory, and heap size, or properties normally passed on with a -D. For instance:
+<br>
+&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; java
+-Djvmflags=ms32M -mx128M
+org.apache.derbyTesting.functionTests.RunTest lang/streamingColumn.java <br>
 excludeJCC<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; See above section
<a
  href="#skipping">4.10</a><br>

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java?rev=170880&r1=170879&r2=170880&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java
Wed May 18 23:12:37 2005
@@ -23,7 +23,7 @@
 /***
  * Sed.java
  *
- * This is a version of "sed" in Java for the Cloudscape Function Tests,
+ * This is a version of "sed" in Java for the Derby Function Tests,
  * written using the OROMatcher Perl5 regular expression classes.
  * The substitutions/deletions are based on the original kornshell tests.
  *
@@ -44,13 +44,13 @@
     }
 
     public static void main(String[] args) throws Exception {
-	if (args == null || args.length != 2) {
-		System.err.println("Usage: Sed sourcefile targetfile");
-		System.exit(1);
-	}
-	File src = new File(args[0]);
-	File tgt = new File(args[1]);
-	new Sed().exec(src,tgt,null, false, false);
+        if (args == null || args.length != 2) {
+            System.err.println("Usage: Sed sourcefile targetfile");
+            System.exit(1);
+        }
+        File src = new File(args[0]);
+        File tgt = new File(args[1]);
+        new Sed().exec(src,tgt,null, false, false);
     }
 
     // The arguments should be the names of the input and output files
@@ -63,8 +63,6 @@
         deleteLines.addElement("^\\*\\*\\*\\* Test Run Started .* \\*\\*\\*\\*$");
         deleteLines.addElement("^\\*\\*\\*\\* Test Run Completed .* \\*\\*\\*\\*$");
         deleteLines.addElement("^ELAPSED TIME = [0-9]* milliseconds$");
-        deleteLines.addElement("^Symantec Java! JustInTime Compiler Version .*$");
-        deleteLines.addElement("^Copyright .* Symantec .*$");
         deleteLines.addElement("^\\^\\?$");
         //deleteLines.addElement("^\\.$"); // originally to remove lines with a dot
         deleteLines.addElement("^S.*ij> $");
@@ -75,20 +73,15 @@
         deleteLines.addElement("^\\[$");
         deleteLines.addElement("^\\]$");
         deleteLines.addElement("^<not available>\\]$");
-        deleteLines.addElement("^weblogic\\..*$");
         deleteLines.addElement("^(.*at .*)\\(.*:[0-9].*\\)$");
         deleteLines.addElement("^(.*at .*)\\(*.java\\)$");
         deleteLines.addElement("^(.*at .*)\\(Compiled Code\\)$");
         deleteLines.addElement("^(.*at .*)\\(Interpreted Code\\)$");
         deleteLines.addElement("^(.*at .*)\\(Unknown Source\\)$");
         deleteLines.addElement("^(.*at .*)\\(Native Method\\)$");
-        deleteLines.addElement("^.*at weblogic\\..*$");
         deleteLines.addElement("^\\tat $"); // rare case of incomplete stack trace line
-        deleteLines.addElement("JBMSTours\\.vti\\.jdbc1_2\\.ExternalTable"); // For some
reason ArchiveData.out outputs it's errors in random order, sed them both out.
         deleteLines.addElement("optimizer estimated cost");
         deleteLines.addElement("optimizer estimated row count");
-        deleteLines.addElement("^WARNING: Cloudscape \\(instance.*$");
-        deleteLines.addElement("^Warning: Cloudscape \\(instance.*$");
         deleteLines.addElement("Using executables built for native_threads");
         deleteLines.addElement("Estimate of memory used");
         deleteLines.addElement("Size of merge runs");
@@ -96,36 +89,25 @@
         deleteLines.addElement("Sort type");
         deleteLines.addElement("Optimization started at .*$");
         deleteLines.addElement("WARNING 02000: No row was found for FETCH, UPDATE or DELETE");
-	// deleteLines for stack traces from j9 jvm to match those above for other jvms
- 	deleteLines.addElement("Stack trace:");	
+        // deleteLines for stack traces from j9 jvm to match those above for other jvms
+        deleteLines.addElement("Stack trace:");	
         deleteLines.addElement("^.*java/.*\\<init\\>\\(.*\\)V");
- 	deleteLines.addElement("^.*org/apache/derby/.*\\(.*\\).*$");	
-	// next for j9 stack trace with jarfiles test run.
- 	deleteLines.addElement("^.*derby/.*\\<.*\\>\\(.*\\).*$");	
- 	deleteLines.addElement("^.*derby/.*\\(.*\\).*$");	
- 	deleteLines.addElement("^.*java/.*\\(.*\\).*$");
-	deleteLines.addElement("^\\[.*db2jcc.jar\\] [0-9].[1-9] - .*$");	
-	deleteLines.addElement("^\\[.*db2jcc_license_c.jar\\] [1-9].[0-9] - .*$");	
+        deleteLines.addElement("^.*org/apache/derby/.*\\(.*\\).*$");	
+        // next for j9 stack trace with jarfiles test run.
+        deleteLines.addElement("^.*derby/.*\\<.*\\>\\(.*\\).*$");	
+        deleteLines.addElement("^.*derby/.*\\(.*\\).*$");	
+        deleteLines.addElement("^.*java/.*\\(.*\\).*$");
+        deleteLines.addElement("^\\[.*db2jcc.jar\\] [0-9].[1-9] - .*$");	
+        deleteLines.addElement("^\\[.*db2jcc_license_c.jar\\] [1-9].[0-9] - .*$");	
+        deleteLines.addElement("^XSDB.*$");
 
         // Vectors for substitutions
         Vector searchStrings = new Vector();
-        searchStrings.addElement("^WARNING: JBMS \\(instance *");
-        searchStrings.addElement("^Warning: JBMS \\(instance *");
-        searchStrings.addElement("^Transaction:\\(.*\\) *\\|");
+        searchStrings.addElement("^Transaction:\\(.*\\) *\\|"); 
         searchStrings.addElement("^Read [0-9]* of [0-9]* bytes$");
-	// added for ibridge connections
-        searchStrings.addElement("jdbc:derby:informix://localhost:1527/");
-        // This was for wl output; it needs some FIXUP to work
-        // or we need to change the masters (which would be easier)
-        //searchStrings.addElement("\\[B\\@[0-9a-f]");
         searchStrings.addElement("Directory .*connect.wombat.seg0");
-        searchStrings.addElement("^ij> Warning: Cloudscape \\(instance.*$");
-        searchStrings.addElement("^ij> WARNING: Cloudscape \\(instance.*$");
-        searchStrings.addElement("^ij(\\([0-9]\\))> WARNING: Cloudscape \\(instance.*$");
-        searchStrings.addElement("^ij(\\([0-9]\\))> Warning: Cloudscape \\(instance.*$");
-        deleteLines.addElement("^XSDB.*$");
         // Filter for constraint names - bug 5622 - our internal constraint names are too
long. To be db2 compatible, we have reworked them.
-        StringBuffer constraintNameFilter = new StringBuffer();
+        StringBuffer constraintNameFilter = new StringBuffer(); 
         constraintNameFilter.append("SQL[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]");
         searchStrings.addElement(constraintNameFilter.toString());
         // Filter for uuids
@@ -136,102 +118,88 @@
         uuidFilter.append("[0-9a-f][0-9a-f][0-9a-f][0-9a-f]-");
         uuidFilter.append("[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]");
         searchStrings.addElement(uuidFilter.toString());
-		// Filter for timestamps
-		StringBuffer	timestampFilter = new StringBuffer();
-		timestampFilter.append( "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] " );
-		timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
-		searchStrings.addElement( timestampFilter.toString() );
-		// 3 digit year
-		timestampFilter = new StringBuffer();
-		timestampFilter.append( "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] " );
-		timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
-		searchStrings.addElement( timestampFilter.toString() );
-		// ibm13 year
-		timestampFilter = new StringBuffer();
-		timestampFilter.append( "[0-9]-[0-9][0-9]-[0-9][0-9] " );
-		timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
-		searchStrings.addElement( timestampFilter.toString() );
-		searchStrings.addElement("^COM\\.jbms\\..*\\|");
-		// Filter remove transaction id's from deadlock messages
-		searchStrings.addElement("^  Waiting XID : {.*}");
-		searchStrings.addElement("^  Granted XID : .*$");
-		searchStrings.addElement("^The selected victim is XID : .*");
-		// Filters for build numbers
-		searchStrings.addElement("(Cloudscape - DBMS:[A-Za-z]* - [0-9]\\.[0-9]\\.[0-9] - )\\(([0-9]*)\\)");
-		searchStrings.addElement("(beta - )\\(([0-9]*)\\)");
-		searchStrings.addElement("Level2CostEstimateImpl: .*");
-		// Filter for xa tests for the numbers representing the db name (it can change)
-		searchStrings.addElement("^Transaction ([0-9])* : \\(([0-9]*)\\,([0-9a-f]*)\\,([0-9a-f]*)\\)");
-		// Filter for optimizer number for zindexesLevel1 test (due to a change in display width
for the test)
-		searchStrings.addElement("^Modifying access paths using optimizer .[0-9]*");
-		searchStrings.addElement("CDWS[0-9]*");
-		searchStrings.addElement("IXWS[0-9]*");
-		searchStrings.addElement("^.*COM.ibm.db2.jdbc.DB2Exception: \\[IBM\\]\\[CLI Driver\\] SQL1013N
 The database alias name or database name \".*\\_M\".*");
-		// for j9, to eliminate intermittent failures due to this problem in j9:
-		searchStrings.addElement("FAILED STACK MAP");
-		if (isJCC)
-		{
-			searchStrings.addElement("[ ]*\\|");
-			searchStrings.addElement("^--*");
-		}
+        // Filter for timestamps
+        StringBuffer timestampFilter = new StringBuffer();
+        timestampFilter.append( "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] " );
+        timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
+        searchStrings.addElement( timestampFilter.toString() );
+        // 3 digit year
+        timestampFilter = new StringBuffer();
+        timestampFilter.append( "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] " );
+        timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
+        searchStrings.addElement( timestampFilter.toString() );
+        // ibm13 year
+        timestampFilter = new StringBuffer();
+        timestampFilter.append( "[0-9]-[0-9][0-9]-[0-9][0-9] " );
+        timestampFilter.append( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]* *" );
+        searchStrings.addElement( timestampFilter.toString() );
+        // Filter remove transaction id's from deadlock messages
+        searchStrings.addElement("^  Waiting XID : {.*}");
+        searchStrings.addElement("^  Granted XID : .*$");
+        searchStrings.addElement("^The selected victim is XID : .*");
+        // Filters for build numbers
+        searchStrings.addElement("(beta - )\\(([0-9]*)\\)");
+        searchStrings.addElement("Level2CostEstimateImpl: .*");
+        // Filter for xa tests for the numbers representing the db name (it can change)
+        searchStrings.addElement("^Transaction ([0-9])* : \\(([0-9]*)\\,([0-9a-f]*)\\,([0-9a-f]*)\\)");
+        // Filter for optimizer number for zindexesLevel1 test (due to a change in display
width for the test)
+        searchStrings.addElement("^Modifying access paths using optimizer .[0-9]*");
+        searchStrings.addElement("CDWS[0-9]*");
+        searchStrings.addElement("IXWS[0-9]*");
+        // for j9, to eliminate intermittent failures due to this problem in j9:
+        searchStrings.addElement("FAILED STACK MAP");
+        if (isJCC)
+        {
+            searchStrings.addElement("[ ]*\\|");
+            searchStrings.addElement("^--*");
+        }
 
-		//Filter to suppress absould paths in error message for roll forward recovery tests 
-		searchStrings.addElement("Directory.*.wombat.already.exists");
+        //Filter to suppress absould paths in error message for roll forward recovery tests

+        searchStrings.addElement("Directory.*.wombat.already.exists");
 
         // Filter for "DB2ConnectionCorrelator" text that can be printed as
         // part of some JCC error messages.
         searchStrings.addElement("  DB2ConnectionCorrelator: [0-9A-Z.]*");
 
         Vector subStrings = new Vector();
-        subStrings.addElement("");
-        subStrings.addElement("");
         subStrings.addElement("Transaction:(XXX)|");
         subStrings.addElement("Read ... bytes");
-		// for iBridge connections
-        subStrings.addElement("cloudscape:derby:");
-        //subStrings.addElement("Bx"); // originally for 
         subStrings.addElement("Directory DBLOCATION/seg0");
-        subStrings.addElement("ij> ");
-        subStrings.addElement("ij> ");
-        subStrings.addElement("ij$1> ");
-        subStrings.addElement("ij$1> ");
         subStrings.addElement("xxxxGENERATED-IDxxxx");
         subStrings.addElement("xxxxFILTERED-UUIDxxxx");
         subStrings.addElement("xxxxxxFILTERED-TIMESTAMPxxxxx");
         subStrings.addElement("xxxxxxFILTERED-TIMESTAMPxxxxx");
         subStrings.addElement("xxxxxxFILTERED-TIMESTAMPxxxxx");
-        subStrings.addElement("Transaction:(XXX)|");
-		// remove transaction id's from deadlock messages
-		subStrings.addElement("  Waiting XID : {WWW,QQQ}");
-		subStrings.addElement("  Granted XID : {GGG.QQQ}...");
-		subStrings.addElement("The selected victim is XID : VVV");
-		// sub build numbers
-		subStrings.addElement("$1(xxXXxxFILTERED-BUILD-NUMBERxxXXxx)");
-		subStrings.addElement("$1(xxXXxxFILTERED-BUILD-NUMBERxxXXxx)");
-		subStrings.addElement("Level2CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx");
-		// sub for db name in xa tests (it can change)
-		subStrings.addElement("Transaction $1 : ($2,FILTERED,FILTERED)");
-		// sub for optimizer number for zindexesLevel1 test
-		subStrings.addElement("Modifying access paths using optimizer FILTERED_NUMBER");
-		subStrings.addElement("CDWSno");
-		subStrings.addElement("IXWSno");
-		subStrings.addElement("COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] SQL1013N  The database
alias name or database name xxxFILTEREDMIRRORDBxxx could not be found.  SQLSTATE=42705");
-		// for j9, to eliminate intermittent failures due to this problem in j9:
-		subStrings.addElement("");
-		// for JCC replace multiple blanks with one blank to handle differences
-		// in display width
-		if (isJCC)
-		{
-			subStrings.addElement(" |");
-			subStrings.addElement("-----");
-		}
-		subStrings.addElement("Directory DBLOCATION/wombat already exists");
-		// ignore the 'DB2ConnectionCorrelator' thing altogether.
-		subStrings.addElement("");
-		doWork(srcFile, dstFile, null, deleteLines, searchStrings, subStrings, isSed, isI18N);
+        // remove transaction id's from deadlock messages
+        subStrings.addElement("  Waiting XID : {WWW,QQQ}");
+        subStrings.addElement("  Granted XID : {GGG.QQQ}...");
+        subStrings.addElement("The selected victim is XID : VVV");
+        // sub build numbers
+        subStrings.addElement("$1(xxXXxxFILTERED-BUILD-NUMBERxxXXxx)");
+        subStrings.addElement("Level2CostEstimateImpl: xxXXxxFILTERED-INFORMATIONxxXXxx");
+        // sub for db name in xa tests (it can change)
+        subStrings.addElement("Transaction $1 : ($2,FILTERED,FILTERED)");
+        // sub for optimizer number for zindexesLevel1 test
+        subStrings.addElement("Modifying access paths using optimizer FILTERED_NUMBER");
+        subStrings.addElement("CDWSno");
+        subStrings.addElement("IXWSno"); 
+        // for j9, to eliminate intermittent failures due to this problem in j9:
+        subStrings.addElement("");
+        // for JCC replace multiple blanks with one blank to handle differences
+        // in display width
+        if (isJCC)
+        {
+            subStrings.addElement(" |");
+            subStrings.addElement("-----"); 
+        }
+        subStrings.addElement("Directory DBLOCATION/wombat already exists");
+        // ignore the 'DB2ConnectionCorrelator' thing altogether.
+        subStrings.addElement("");
+        doWork(srcFile, dstFile, null, deleteLines, searchStrings, subStrings, isSed, isI18N);
+        
+    } // end exec
 
-	}
-	// This just does JCC changes on the output master file
+    // This just does JCC changes on the output master file
     public void execJCC(InputStream is, File dstFile)
         throws IOException
     {
@@ -240,48 +208,31 @@
 
         // Vectors for substitutions
         Vector searchStrings = new Vector();
-		searchStrings.addElement("[ ]*\\|");
-		searchStrings.addElement("^--*");
+        searchStrings.addElement("[ ]*\\|");
+        searchStrings.addElement("^--*");
 
         Vector subStrings = new Vector();
-		// true and false show up as 1 and 0 in JCC. 
-		//because they have no boolean support
-		subStrings.addElement(" |");
-		subStrings.addElement("-----");
-
-		doWork(null, dstFile, is, deleteLines, searchStrings, subStrings, null);
-
-	}
-	// for rmi, there's a warning about the db, but it's really ok.
-    public void rmiexec(File srcFile, File dstFile, InputStream isSed)
-        throws IOException
-    {
-        // Vector for storing lines to be deleted
-        Vector deleteLines = new Vector();
-		// for Rmi:
-	 	deleteLines.addElement("^.*WARNING: Wierd RMI server URL:.*$");	
-	 	deleteLines.addElement("^.*WARNING 01J01: Database 'wombat' not created, connection made
to existing database instead.");	
+        // true and false show up as 1 and 0 in JCC. 
+        //because they have no boolean support
+        subStrings.addElement(" |");
+        subStrings.addElement("-----");
 
-        Vector searchStrings = new Vector();
-		//searchStrings.addElement("");
-        Vector subStrings = new Vector();
-		//subStrings.addElement("");
+        doWork(null, dstFile, is, deleteLines, searchStrings, subStrings, null);
 
-		doWork(srcFile, dstFile, null, deleteLines, searchStrings, subStrings, isSed);
-	}
+    }
 
-	private void doWork(File srcFile, File dstFile, InputStream is, Vector deleteLines, 
-		Vector searchStrings, Vector subStrings, InputStream isSed)
+    private void doWork(File srcFile, File dstFile, InputStream is, Vector deleteLines, 
+        Vector searchStrings, Vector subStrings, InputStream isSed)
         throws IOException
-	{
-		doWork(srcFile, dstFile, is, deleteLines, searchStrings, subStrings, isSed, false);
-	}
+    {
+        doWork(srcFile, dstFile, is, deleteLines, searchStrings, subStrings, isSed, false);
+    }
 		
 
-	private void doWork(File srcFile, File dstFile, InputStream is, Vector deleteLines, 
-		Vector searchStrings, Vector subStrings, InputStream isSed, boolean isI18N)
+    private void doWork(File srcFile, File dstFile, InputStream is, Vector deleteLines, 
+        Vector searchStrings, Vector subStrings, InputStream isSed, boolean isI18N)
         throws IOException
-	{
+    {
 		
         boolean lineDeleted = false;
         PatternMatcher matcher;
@@ -294,66 +245,66 @@
         Vector delPatternVector = new Vector();
         Vector subPatternVector = new Vector();
 
-	// ---------------------------------
+        // ---------------------------------
         // Try loading the sed properties if they exist (see jdbc_sed.properties as an example)
         if ( isSed != null )
         {
-	    Properties sedp = new Properties();
-		
+            Properties sedp = new Properties();
+
             sedp.load(isSed);
-	    for (Enumeration e = sedp.propertyNames(); e.hasMoreElements(); )
-		{
-		    String key = (String)e.nextElement();
-		    if (key.equals("substitute"))
-		    {
-			String value = sedp.getProperty(key);
-			// value string contains a comma separated list of patterns
-			StringTokenizer st = new StringTokenizer(value,",");
-			String patternName = ""; 
-			String patName = ""; 
-			String subName = ""; 
-			while (st.hasMoreTokens())
-			{
-			    patternName = st.nextToken();
-			    // pattern;substitute
-			    StringTokenizer st2 = new StringTokenizer(patternName,";");
-			    patName = st2.nextToken();
-			    subName = st2.nextToken();
-			    if (!patName.equals("") && !subName.equals(""))
-			    {
-				searchStrings.addElement(patName);
-				subStrings.addElement(subName);
-			    }
-//System.out.println("pattern = " + patName + " substitute " + subName);
-			}
-		    }
-		    else if (key.equals("delete"))
-		    {
-			String value = sedp.getProperty(key);
-			// value string contains a comma separated list of patterns
-			StringTokenizer st = new StringTokenizer(value,",");
-			String patternName = ""; 
-			while (st.hasMoreTokens())
-			{
-			    patternName = st.nextToken();
-			    deleteLines.addElement(patternName);
-			}
-		    }
+            for (Enumeration e = sedp.propertyNames(); e.hasMoreElements(); )
+            {
+                String key = (String)e.nextElement();
+                if (key.equals("substitute"))
+                {
+                    String value = sedp.getProperty(key);
+                    // value string contains a comma separated list of patterns
+                    StringTokenizer st = new StringTokenizer(value,",");
+                    String patternName = ""; 
+                    String patName = ""; 
+                    String subName = ""; 
+                    while (st.hasMoreTokens())
+                    {
+                        patternName = st.nextToken();
+                        // pattern;substitute
+                        StringTokenizer st2 = new StringTokenizer(patternName,";");
+                        patName = st2.nextToken();
+                        subName = st2.nextToken();
+                        if (!patName.equals("") && !subName.equals(""))
+                        {
+                            searchStrings.addElement(patName);
+                            subStrings.addElement(subName);
+                        }
+                    //System.out.println("pattern = " + patName + " substitute " + subName);
+                    }
                 }
+                else if (key.equals("delete"))
+                {
+                    String value = sedp.getProperty(key);
+                    // value string contains a comma separated list of patterns
+                    StringTokenizer st = new StringTokenizer(value,",");
+                    String patternName = ""; 
+                    while (st.hasMoreTokens())
+                    {
+                        patternName = st.nextToken();
+                        deleteLines.addElement(patternName);
+                    }
+                }
+            }
         }
-	// ---------------------------------
+        // ---------------------------------
 
         //Create Perl5Compiler and Perl5Matcher
         pcompiler = new Perl5Compiler();
         matcher = new Perl5Matcher();
 
         // Define the input and output files based on args
-		if (is == null)
-        	inFile = new BufferedReader(new FileReader(srcFile));
-		else
-			inFile = new BufferedReader(new InputStreamReader(is));
+        if (is == null)
+            inFile = new BufferedReader(new FileReader(srcFile));
+        else
+            inFile = new BufferedReader(new InputStreamReader(is));
         outFile = new PrintWriter
-            ( new BufferedWriter(new FileWriter(dstFile), 10000), true );
+        ( new BufferedWriter(new FileWriter(dstFile), 10000), true );
 
         // Attempt to compile the patterns for deletes
         for (int i = 0; i < deleteLines.size(); i++)
@@ -400,7 +351,7 @@
         while ( (str = inFile.readLine()) != null )
         {
             lineCount++;
-            
+        
             //System.out.println("***Line no: " + lineCount);
             //System.out.println("***Line is: " + str);
             lineDeleted = false;
@@ -448,15 +399,13 @@
                             sb.append((int) str.charAt(si));
                             sb.append("< ");
                         }
-			else
+                        else
                             sb.append(c);
                     }
                     str = sb.toString();
                 }
             }
 
-
-
             // Determine if this line should be deleted for delete pattern match
             if ( lineDeleted == false )
             {
@@ -478,9 +427,9 @@
             // Determine if any substitutions are needed
             if (lineDeleted == false)
             {
-		Substitution substitution;
-		StringSubstitution strsub = new StringSubstitution("");
-		Perl5Substitution perlsub = new Perl5Substitution("");
+                Substitution substitution;
+                StringSubstitution strsub = new StringSubstitution("");
+                Perl5Substitution perlsub = new Perl5Substitution("");
                 boolean subDone = false;
                 for (j = 0; j < subPatternVector.size(); j++)
                 {
@@ -489,14 +438,14 @@
                     String pstr = patt.getPattern();
                     //System.out.println("Pattern string is " + pstr);
                     String sub = (String)subStrings.elementAt(j);
-		    if (sub.indexOf("$") > 0)
-		    {
+                    if (sub.indexOf("$") > 0)
+                    {
                         perlsub.setSubstitution(sub);
                         substitution = (Substitution)perlsub;
                     } else {
                         strsub.setSubstitution(sub);
-			substitution = (Substitution)strsub;
-		    }
+                        substitution = (Substitution)strsub;
+                    }
                     //System.out.println("Substitute str = " + sub);
                     if ( matcher.contains( input, patt ) )
                     {
@@ -504,7 +453,7 @@
                         //System.out.println("***Match found for substitute***");
                         // In this case we do a substitute
                         result = Util.substitute(matcher, patt, substitution, str,
-                            Util.SUBSTITUTE_ALL);
+                        Util.SUBSTITUTE_ALL);
                         //System.out.println("New string: " + result);
                         //outFile.println(result);
                         str = result;
@@ -527,5 +476,5 @@
         inFile.close();
         outFile.flush();
         outFile.close();
-    }// end exec
+    }// end doWork
 }



Mime
View raw message