aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/test
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-08-18 11:15:50 +0200
committerJon Bratseth <bratseth@gmail.com>2020-08-18 11:15:50 +0200
commitc30bbdb0fa50cedc56eec71feeadc969ba5a3edf (patch)
tree6935b4d042618900ee0f7fd291c14ed55ae06cf8 /container-search/src/test/java/com/yahoo/search/test
parent529694a88d48270298171fdcb87d1439f183202b (diff)
Skip logging only for IllegalInputException
- Add IllegalInputException to signal cases where we know the exception is caused by illegal input received from the requestor. - Only skip logging for IllegalInputException instead of the superclass IllegalArgumentException as that is also used to signal illegal arguments to methods due to bugs which are otherwise hard to debug. - Throw IllegalInputException rather than IllegalArgumentException where appropriate. - Deprecated QueryException as it was only used to be able to separate between query string and query parameter exceptions, and not doing that consistently, and is in a package we don't want more use of. - Clean up some cases where the wrong exception was thrown.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/test')
-rw-r--r--container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
index 3a67245e912..a42a2ee55aa 100644
--- a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java
@@ -23,7 +23,6 @@ import com.yahoo.prelude.query.IndexedItem;
import com.yahoo.prelude.query.IntItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.OrItem;
-import com.yahoo.prelude.query.QueryException;
import com.yahoo.prelude.query.RankItem;
import com.yahoo.prelude.query.WordItem;
import com.yahoo.processing.request.CompoundName;
@@ -47,7 +46,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -289,7 +287,7 @@ public class QueryTestCase {
try {
new Query(httpEncode("/search?timeout=nalle"));
fail("Above statement should throw");
- } catch (QueryException e) {
+ } catch (IllegalArgumentException e) {
// As expected.
assertTrue(Exceptions.toMessageString(e).contains("Could not set 'timeout' to 'nalle': Error parsing 'nalle': Invalid number 'nalle'"));
}
@@ -865,7 +863,7 @@ public class QueryTestCase {
root.addItem(child);
fail("Expected exception");
}
- catch (QueryException e) {
+ catch (IllegalArgumentException e) {
assertEquals("Cannot add OR (AND ) to (AND ) as it would create a cycle", e.getMessage());
}
@@ -875,7 +873,7 @@ public class QueryTestCase {
child.addItem(root);
fail("Expected exception");
}
- catch (QueryException e) {
+ catch (IllegalArgumentException e) {
assertEquals("Cannot add (AND (OR )) to (OR ) as it would create a cycle", e.getMessage());
}
}