lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r424708 - in /lucene/java/trunk/src/java/org/apache/lucene/queryParser: QueryParser.java QueryParser.jj
Date Sun, 23 Jul 2006 11:08:37 GMT
Author: dnaber
Date: Sun Jul 23 04:08:36 2006
New Revision: 424708

URL: http://svn.apache.org/viewvc?rev=424708&view=rev
Log:
add the original query to the parse exception message for easier debugging

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java?rev=424708&r1=424707&r2=424708&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java Sun Jul 23 04:08:36
2006
@@ -121,11 +121,15 @@
     try {
       return Query(field);
     }
+    catch (ParseException tme) {
+      // rethrow to include the original query:
+      throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
+    }
     catch (TokenMgrError tme) {
-      throw new ParseException(tme.getMessage());
+      throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
     }
     catch (BooleanQuery.TooManyClauses tmc) {
-      throw new ParseException("Too many boolean clauses");
+      throw new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
     }
   }
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj?rev=424708&r1=424707&r2=424708&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj Sun Jul 23 04:08:36
2006
@@ -144,11 +144,15 @@
     try {
       return Query(field);
     }
+    catch (ParseException tme) {
+      // rethrow to include the original query:
+      throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
+    }
     catch (TokenMgrError tme) {
-      throw new ParseException(tme.getMessage());
+      throw new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
     }
     catch (BooleanQuery.TooManyClauses tmc) {
-      throw new ParseException("Too many boolean clauses");
+      throw new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
     }
   }
   



Mime
View raw message