Repository: cxf Updated Branches: refs/heads/master 0566a4ea0 -> 519a67dfa
[CXF-6843]:http 406 not acceptable should be returned if query parameter value can't be converted Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/519a67df Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/519a67df Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/519a67df Branch: refs/heads/master Commit: 519a67dfa240471bb585929f263cd85051a9eb06 Parents: 0566a4e Author: Jim Ma <[email protected]> Authored: Fri Mar 25 13:31:31 2016 +0800 Committer: Jim Ma <[email protected]> Committed: Fri Mar 25 13:31:31 2016 +0800 ---------------------------------------------------------------------- .../java/org/apache/cxf/jaxrs/utils/InjectionUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/519a67df/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java index fa42c6f..99a6e1d 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java @@ -459,13 +459,14 @@ public final class InjectionUtils { private static RuntimeException createParamConversionException(ParameterType pType, Exception ex) { // - // For path, query & matrix parameters this is 404, + // For path & matrix parameters this is 404, for query is 406 // for others 400... // - if (pType == ParameterType.PATH || pType == ParameterType.QUERY - || pType == ParameterType.MATRIX) { + if (pType == ParameterType.QUERY) { + return ExceptionUtils.toNotAcceptableException(ex, null); + } else if (pType == ParameterType.PATH || pType == ParameterType.MATRIX) { return ExceptionUtils.toNotFoundException(ex, null); - } + } return ExceptionUtils.toBadRequestException(ex, null); } public static <T> T createFromParameterHandler(String value,
