[seam-commits] Seam SVN: r10612 - branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/persistence.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Apr 23 11:25:31 EDT 2009
Author: manaRH
Date: 2009-04-23 11:25:30 -0400 (Thu, 23 Apr 2009)
New Revision: 10612
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/persistence/QueryParser.java
Log:
JBPAPP-1927
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/persistence/QueryParser.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/persistence/QueryParser.java 2009-04-23 14:30:16 UTC (rev 10611)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/persistence/QueryParser.java 2009-04-23 15:25:30 UTC (rev 10612)
@@ -36,28 +36,23 @@
public QueryParser(String ejbql, int startingParameterNumber)
{
StringTokenizer tokens = new StringTokenizer(ejbql, "#}", true);
- ejbqlBuilder = new StringBuilder( ejbql.length() );
+ ejbqlBuilder = new StringBuilder(ejbql.length());
while ( tokens.hasMoreTokens() )
{
String token = tokens.nextToken();
- if ( "#".equals(token) )
+ if ( "#".equals(token) && tokens.hasMoreTokens() )
{
- if ( !tokens.hasMoreTokens() )
- {
- throw new IllegalArgumentException("query fragment terminates in #");
- }
String expressionToken = tokens.nextToken();
- if ( !expressionToken.startsWith("{") )
+ if ( !expressionToken.startsWith("{") || !tokens.hasMoreTokens() )
{
- throw new IllegalArgumentException("missing { after # in query fragment");
+ ejbqlBuilder.append(token).append(expressionToken);
}
- if ( !tokens.hasMoreTokens() )
+ else
{
- throw new IllegalArgumentException("missing } after expression in query fragment");
+ String expression = token + expressionToken + tokens.nextToken();
+ ejbqlBuilder.append(':').append(getParameterName(startingParameterNumber + parameterValueBindings.size()));
+ parameterValueBindings.add(Expressions.instance().createValueExpression(expression));
}
- String expression = token + expressionToken + tokens.nextToken();
- ejbqlBuilder.append(':').append( getParameterName( startingParameterNumber + parameterValueBindings.size() ) );
- parameterValueBindings.add( Expressions.instance().createValueExpression(expression) );
}
else
{
More information about the seam-commits
mailing list