From c30bbdb0fa50cedc56eec71feeadc969ba5a3edf Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Tue, 18 Aug 2020 11:15:50 +0200 Subject: 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. --- .../query/profile/types/test/NativePropertiesTestCase.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'container-search/src/test/java/com/yahoo/search/query/profile/types/test/NativePropertiesTestCase.java') diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/NativePropertiesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/NativePropertiesTestCase.java index 224b0c82339..2ced2ba9323 100644 --- a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/NativePropertiesTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/NativePropertiesTestCase.java @@ -3,7 +3,6 @@ package com.yahoo.search.query.profile.types.test; import com.yahoo.jdisc.http.HttpRequest.Method; import com.yahoo.container.jdisc.HttpRequest; -import com.yahoo.prelude.query.QueryException; import com.yahoo.search.Query; import com.yahoo.search.query.profile.QueryProfile; import com.yahoo.search.query.profile.types.QueryProfileType; @@ -23,22 +22,22 @@ public class NativePropertiesTestCase { @Test public void testNativeInStrict() { - QueryProfileType strictType=new QueryProfileType("strict"); + QueryProfileType strictType = new QueryProfileType("strict"); strictType.setStrict(true); - QueryProfile strict=new QueryProfile("profile"); + QueryProfile strict = new QueryProfile("profile"); strict.setType(strictType); try { new Query(HttpRequest.createTestRequest("?hits=10&tracelevel=5", Method.GET), strict.compile(null)); fail("Above statement should throw"); - } catch (QueryException e) { + } catch (IllegalArgumentException e) { // As expected. } try { new Query(HttpRequest.createTestRequest("?notnative=5", Method.GET), strict.compile(null)); fail("Above statement should throw"); - } catch (QueryException e) { + } catch (IllegalArgumentException e) { // As expected. assertThat( Exceptions.toMessageString(e), -- cgit v1.2.3