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 bp...@apache.org on 2007/09/07 05:01:24 UTC

svn commit: r573432 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java

Author: bpendleton
Date: Thu Sep  6 20:01:24 2007
New Revision: 573432

URL: http://svn.apache.org/viewvc?rev=573432&view=rev
Log:
DERBY-2151: Fixer-upper utility to help convert ij canon tests to JUnit

This patch modifies SQLToJUnit.java so that it quietly skips entirely
blank lines. Prior to this patch, such lines could cause SQLToJUnit to
throw a NullPointerException. An example of a canon with entirely
blank lines is tests/lang/groupBy.sql.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java?rev=573432&r1=573431&r2=573432&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SQLToJUnit.java Thu Sep  6 20:01:24 2007
@@ -1170,11 +1170,19 @@
         	}
         	int linetype;
         	
+            // Skip entirely blank lines:
+            while (nextline != null)
+            {
+                nextline = nextline.trim();
+                if (nextline.length() == 0)
+                    nextline = ijScript.readLine();	
+                else
+                    break;
+            }
         	if (nextline == null) {
         		c = -1;
         		break;
         	} else {
-        		nextline = nextline.trim();
         		linetype = getLineType(nextline);
         		// multiple lines of SQL comments will be condensed in convert().
         		// If we are inside a result set, allow the first line of a command