cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1543498 - in /cxf/branches/2.7.x-fixes: ./ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/
Date Tue, 19 Nov 2013 17:02:21 GMT
Author: sergeyb
Date: Tue Nov 19 17:02:21 2013
New Revision: 1543498

URL: http://svn.apache.org/r1543498
Log:
Merged revisions 1543491,1543494 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1543491 | sergeyb | 2013-11-19 16:54:17 +0000 (Tue, 19 Nov 2013) | 1 line
  
  [CXF-5400] Propagating SearchParseException by default
........
  r1543494 | sergeyb | 2013-11-19 16:56:17 +0000 (Tue, 19 Nov 2013) | 1 line
  
  [CXF-5400] Removing redundant test assert
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextImpl.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchParseException.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/SearchContextImplTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1543491-1543494

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextImpl.java?rev=1543498&r1=1543497&r2=1543498&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextImpl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContextImpl.java
Tue Nov 19 17:02:21 2013
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PropertyUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
 import org.apache.cxf.jaxrs.ext.search.client.SearchConditionBuilder;
@@ -44,6 +45,7 @@ public class SearchContextImpl implement
     public static final String CUSTOM_SEARCH_QUERY_PARAM_NAME = "search.query.parameter.name";
     private static final String USE_PLAIN_QUERY_PARAMETERS = "search.use.plain.queries";
     private static final String USE_ALL_QUERY_COMPONENT = "search.use.all.query.component";
+    private static final String BLOCK_SEARCH_EXCEPTION = "search.block.search.exception";
     private static final Logger LOG = LogUtils.getL7dLogger(SearchContextImpl.class);
     private Message message;
     
@@ -93,7 +95,12 @@ public class SearchContextImpl implement
             try {
                 return parser.parse(theExpression);
             } catch (SearchParseException ex) {
-                return null;
+                Object prop = message.getContextualProperty(BLOCK_SEARCH_EXCEPTION);  
+                if (prop != null && !PropertyUtils.isTrue(prop)) {
+                    throw ex;
+                } else {
+                    return null;
+                }
             }
         } else {
             return null;

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchParseException.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchParseException.java?rev=1543498&r1=1543497&r2=1543498&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchParseException.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchParseException.java
Tue Nov 19 17:02:21 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.jaxrs.ext.search;
 
-public class SearchParseException extends Exception {
+public class SearchParseException extends RuntimeException {
 
     private static final long serialVersionUID = 1182999957472822704L;
 

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/SearchContextImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/SearchContextImplTest.java?rev=1543498&r1=1543497&r2=1543498&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/SearchContextImplTest.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/SearchContextImplTest.java
Tue Nov 19 17:02:21 2013
@@ -39,6 +39,21 @@ public class SearchContextImplTest exten
     }
     
     @Test
+    public void testWrongQueryNoException() {
+        Message m = new MessageImpl();
+        m.put(Message.QUERY_STRING, "_s=ab");
+        assertNull(new SearchContextImpl(m).getCondition(Book.class));
+    }
+    
+    @Test(expected = SearchParseException.class)
+    public void testWrongQueryException() {
+        Message m = new MessageImpl();
+        m.put("search.block.search.exception", false); 
+        m.put(Message.QUERY_STRING, "_s=ab");
+        new SearchContextImpl(m).getCondition(Book.class);
+    }
+    
+    @Test
     public void testPlainQuery2() {
         Message m = new MessageImpl();
         m.put("search.use.plain.queries", true);



Mime
View raw message