Repository: cxf Updated Branches: refs/heads/master 1ffd27f24 -> d786ec0f0
[CXF-7121] Logging a warning when asyn methods return non-void types, patch from andy McCright applied, This closes #189 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d786ec0f Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d786ec0f Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d786ec0f Branch: refs/heads/master Commit: d786ec0f04b439a1cabfdbe38c0d912abf0f061c Parents: 1ffd27f Author: Sergey Beryozkin <[email protected]> Authored: Wed Nov 2 16:19:40 2016 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Nov 2 16:19:40 2016 +0000 ---------------------------------------------------------------------- .../apache/cxf/jaxrs/utils/ResourceUtils.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/d786ec0f/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java index 9cac0fb..ced9fc1 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java @@ -329,39 +329,40 @@ public final class ResourceUtils { } } } else { - reportInvalidResourceMethod(m, NOT_RESOURCE_METHOD_MESSAGE_ID); + reportInvalidResourceMethod(m, NOT_RESOURCE_METHOD_MESSAGE_ID, Level.FINE); } } cri.setMethodDispatcher(md); } - - private static void reportInvalidResourceMethod(Method m, String messageId) { - if (LOG.isLoggable(Level.FINE)) { - LOG.fine(new org.apache.cxf.common.i18n.Message(messageId, + + private static void reportInvalidResourceMethod(Method m, String messageId, Level logLevel) { + if (LOG.isLoggable(logLevel)) { + LOG.log(logLevel, new org.apache.cxf.common.i18n.Message(messageId, BUNDLE, m.getDeclaringClass().getName(), m.getName()).toString()); } - } + private static boolean checkAsyncResponse(Method m) { Class<?>[] types = m.getParameterTypes(); for (int i = 0; i < types.length; i++) { if (types[i] == AsyncResponse.class) { if (AnnotationUtils.getAnnotation(m.getParameterAnnotations()[i], Suspended.class) == null) { - reportInvalidResourceMethod(m, NOT_SUSPENDED_ASYNC_MESSAGE_ID); + reportInvalidResourceMethod(m, NOT_SUSPENDED_ASYNC_MESSAGE_ID, Level.FINE); return false; } if (m.getReturnType() == Void.TYPE || m.getReturnType() == Void.class) { return true; } else { - reportInvalidResourceMethod(m, NO_VOID_RETURN_ASYNC_MESSAGE_ID); + reportInvalidResourceMethod(m, NO_VOID_RETURN_ASYNC_MESSAGE_ID, Level.WARNING); return false; } - } + } } return true; } + private static ClassResourceInfo getAncestorWithSameServiceClass(ClassResourceInfo parent, Class<?> subClass) { if (parent == null) { return null;
