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 rh...@apache.org on 2013/06/18 19:27:15 UTC

svn commit: r1494220 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java

Author: rhillegas
Date: Tue Jun 18 17:27:15 2013
New Revision: 1494220

URL: http://svn.apache.org/r1494220
Log:
DERBY-6263: Add defensive code to Visitor support in SelectNode; tests passed cleanly on derby-6263-03-ab-defensiveNullChecking-in-SelectNode.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=1494220&r1=1494219&r2=1494220&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Tue Jun 18 17:27:15 2013
@@ -339,10 +339,15 @@ public class SelectNode extends ResultSe
 				havingClause.treePrint(depth + 1);
 			}
 
-            if (orderByLists[0] != null) {
-                for (int i = 0; i < orderByLists.length; i++) {
-                    printLabel(depth, "orderByLists[" + i + "]:");
-                    orderByLists[i].treePrint(depth + 1);
+            if (orderByLists != null)
+            {
+                for (int i = 0; i < orderByLists.length; i++)
+                {
+                    if ( orderByLists[i] != null )
+                    {
+                        printLabel(depth, "orderByLists[" + i + "]:");
+                        orderByLists[i].treePrint(depth + 1);
+                    }
                 }
 			}
 
@@ -2552,9 +2557,14 @@ public class SelectNode extends ResultSe
                 groupByList = (GroupByList) groupByList.accept( v );
             }
         
-            if (orderByLists[0] != null) {
-                for (int i = 0; i < orderByLists.length; i++) {
-                    orderByLists[i] = (OrderByList) orderByLists[ i ].accept( v );
+            if (orderByLists != null)
+            {
+                for (int i = 0; i < orderByLists.length; i++)
+                {
+                    if ( orderByLists[ i ] != null )
+                    {
+                        orderByLists[i] = (OrderByList) orderByLists[ i ].accept( v );
+                    }
                 }
             }