[exo-jcr-commits] exo-jcr SVN: r2258 - jcr/branches/1.14.x/exo.jcr.component.core/src/main/javacc/sql.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Apr 9 09:49:52 EDT 2010


Author: sergiykarpenko
Date: 2010-04-09 09:49:51 -0400 (Fri, 09 Apr 2010)
New Revision: 2258

Modified:
   jcr/branches/1.14.x/exo.jcr.component.core/src/main/javacc/sql/JCRSQL.jjt
Log:
EXOJCR-498: TokenMgrError is wrapped by ParseException with new message.

Modified: jcr/branches/1.14.x/exo.jcr.component.core/src/main/javacc/sql/JCRSQL.jjt
===================================================================
--- jcr/branches/1.14.x/exo.jcr.component.core/src/main/javacc/sql/JCRSQL.jjt	2010-04-09 12:39:05 UTC (rev 2257)
+++ jcr/branches/1.14.x/exo.jcr.component.core/src/main/javacc/sql/JCRSQL.jjt	2010-04-09 13:49:51 UTC (rev 2258)
@@ -75,6 +75,30 @@
 //        this.resolver = resolver;
 //  } 
 
+  void handleTokenMgrError(TokenMgrError e) throws ParseException{
+    if (e.errorCode == e.LEXICAL_ERROR)
+    {
+      StringBuffer sb = new StringBuffer();
+      try
+      {
+        char c;
+        while ((c = token_source.input_stream.readChar()) != ' ')
+        {
+          sb.append(c);
+        }
+      }
+      catch (java.io.IOException ioe)
+      {
+        // probably EOF occurs, but any way, do not report this exceptions 
+      }
+
+      throw new ParseException("Unknown Query Construction : \"" + sb.toString() + "\". " + e.getMessage());
+    }
+    else
+    {
+      throw e;
+    }
+  }
 }
 
 PARSER_END(JCRSQLParser)
@@ -269,11 +293,18 @@
 ASTQuery Query() :
 {}
 {
+  try{
+
   <SELECT>
   SelectList()
   TableExpression()
   [ OrderByClause() ]
   <EOF>
+  
+  }catch(TokenMgrError e){
+    handleTokenMgrError(e);
+  }
+  
   { return jjtThis; }
 }
 



More information about the exo-jcr-commits mailing list