chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1085144 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java
Date Thu, 24 Mar 2011 21:04:24 GMT
Author: jens
Date: Thu Mar 24 21:04:23 2011
New Revision: 1085144

URL: http://svn.apache.org/viewvc?rev=1085144&view=rev
Log:
Apply patch CMIS-337 (fixes in QueryUtil)

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java?rev=1085144&r1=1085143&r2=1085144&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtil.java
Thu Mar 24 21:04:23 2011
@@ -18,10 +18,6 @@
  */
 package org.apache.chemistry.opencmis.server.support.query;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
 import org.antlr.runtime.ANTLRInputStream;
 import org.antlr.runtime.BaseRecognizer;
 import org.antlr.runtime.CharStream;
@@ -35,17 +31,20 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictParser_CmisBaseGrammar.query_return;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
 /**
- * Class with static methods that contains convenience methods to repeating functionality
- * in context with query and ANTLR parsing
+ * Utility class providing convenience methods for parsing CMIS queries. 
  *
  */
-public class QueryUtil extends QueryObject {
+public class QueryUtil {
 
     private CmisQueryWalker walker;
-    
+
     // convenience method because everybody needs this piece of code
-    public CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException,
IOException, RecognitionException {
+    public static CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException,
IOException, RecognitionException {
         
         CharStream input = new ANTLRInputStream(new ByteArrayInputStream(statement.getBytes("UTF-8")));
         TokenSource lexer = new CmisQlStrictLexer(input);
@@ -73,11 +72,10 @@ public class QueryUtil extends QueryObje
     }
     
     public CmisQueryWalker traverseStatementAndCatchExc(String statement, QueryObject queryObj,
PredicateWalkerBase pw) {
-        QueryUtil queryUtil = new QueryUtil();
         try {
             return traverseStatement(statement, queryObj, pw);
         } catch (RecognitionException e) {
-            String errorMsg = queryUtil.getErrorMessage();
+            String errorMsg = queryObj.getErrorMessage();
             throw new CmisInvalidArgumentException("Walking of statement failed with RecognitionException
error: \n   " + errorMsg);
         } catch (CmisBaseException e) {
             throw e;
@@ -93,7 +91,7 @@ public class QueryUtil extends QueryObje
             return getErrorMessage(walker, e);
     }
     
-    private String getErrorMessage(BaseRecognizer recognizer, RecognitionException e) {
+    private static String getErrorMessage(BaseRecognizer recognizer, RecognitionException
e) {
         String[] tokenNames = recognizer.getTokenNames();
         // String hdr = walker.getErrorHeader(e);
         String hdr = "Line "+e.line+":"+e.charPositionInLine;



Mime
View raw message