cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1143263 - in /cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main: java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
Date Wed, 06 Jul 2011 06:58:27 GMT
Author: aadamchik
Date: Wed Jul  6 06:58:27 2011
New Revision: 1143263

URL: http://svn.apache.org/viewvc?rev=1143263&view=rev
Log:
CAY-1514 ClassCastException when EJQLQuery parameters is null.

ejbql-null-parameters.patch by Dzmitry Kazimirchyk

Modified:
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java?rev=1143263&r1=1143262&r2=1143263&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
Wed Jul  6 06:58:27 2011
@@ -385,7 +385,7 @@ public class EJBQLConditionTranslator ex
     }
     
     /**
-     * Checks expression for containing null imput parameter.
+     * Checks expression for containing null input parameter.
      * For that, we'll append IS NULL or IS NOT NULL instead of =null or <>null
      * @return whether replacement was done and there's no need for normal expression processing
      */
@@ -562,6 +562,10 @@ public class EJBQLConditionTranslator ex
     @Override
     public boolean visitLike(EJBQLExpression expression, int finishedChildIndex) {
         if (finishedChildIndex == 0) {
+            if (checkNullParameter(expression, " IS NULL")) {
+                return false;
+            }
+            
             if (expression.isNegated()) {
                 context.append(" NOT");
             }

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt?rev=1143263&r1=1143262&r2=1143263&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt
Wed Jul  6 06:58:27 2011
@@ -693,7 +693,8 @@ void literal_or_param() : { }
 
 void like_expression() #Like : { }
 {
-	string_expression() [<NOT> { jjtThis.not = true; }] <LIKE> pattern_value() 
+	string_expression() [<NOT> { jjtThis.not = true; }] <LIKE> 
+	((input_parameter() [(<ESCAPE> escape_character())]) | pattern_value())  
 }
 
 
@@ -1208,8 +1209,7 @@ void positional_input_parameter() #Posit
 
 void pattern_value() #PatternValue : { }
 {
-	(input_parameter() | string_literal())
-	[(<ESCAPE> escape_character())]
+	string_literal() [(<ESCAPE> escape_character())]
 }
 
 



Mime
View raw message