From 74f15f6a7446c49c4730388322ddda8a62d30ee6 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Mon, 20 Jul 2015 11:09:32 +0200 Subject: [PATCH] WELD-1871 Revised BeanLogger.methodNotBusinessMethod() --- impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java | 3 ++- .../jboss/weld/injection/producer/ProducerMethodProducer.java | 2 +- impl/src/main/java/org/jboss/weld/logging/BeanLogger.java | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java b/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java index 10576cb0116..b708fd688b1 100644 --- a/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java +++ b/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java @@ -121,7 +121,8 @@ private void checkDisposalMethod(EnhancedAnnotatedMethod enhancedA SessionBean sessionBean = (SessionBean) declaringBean; Set businessMethodSignatures = sessionBean.getBusinessMethodSignatures(); if (!businessMethodSignatures.contains(enhancedAnnotatedMethod.getSignature())) { - throw BeanLogger.LOG.methodNotBusinessMethod(enhancedAnnotatedMethod, declaringBean); + throw BeanLogger.LOG.methodNotBusinessMethod("Disposer", enhancedAnnotatedMethod, declaringBean, + Formats.formatAsStackTraceElement(enhancedAnnotatedMethod.getJavaMember())); } } for (ParameterInjectionPoint ip : disposalMethodInjectionPoint.getParameterInjectionPoints()) { diff --git a/impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java b/impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java index c9e3e8af778..9ce79dd946c 100644 --- a/impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java +++ b/impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java @@ -83,7 +83,7 @@ protected void checkProducerMethod(EnhancedAnnotatedMethod method) } } if (!methodDeclaredOnTypes) { - throw BeanLogger.LOG.methodNotBusinessMethod(this, getDeclaringBean()); + throw BeanLogger.LOG.methodNotBusinessMethod("Producer", this, getDeclaringBean(), Formats.formatAsStackTraceElement(method.getJavaMember())); } } } diff --git a/impl/src/main/java/org/jboss/weld/logging/BeanLogger.java b/impl/src/main/java/org/jboss/weld/logging/BeanLogger.java index 53155768336..70a88484883 100644 --- a/impl/src/main/java/org/jboss/weld/logging/BeanLogger.java +++ b/impl/src/main/java/org/jboss/weld/logging/BeanLogger.java @@ -205,8 +205,8 @@ public interface BeanLogger extends WeldLogger { @Message(id = 67, value = "{0} is not allowed on same method as {1}, see {2}\n\tat {3}\n StackTrace:", format = Format.MESSAGE_FORMAT) DefinitionException inconsistentAnnotationsOnMethod(Object param1, Object param2, Object param3, Object stackElement); - @Message(id = 68, value = "Method {0} must be declared on a business interface of {1}", format = Format.MESSAGE_FORMAT) - DefinitionException methodNotBusinessMethod(Object param1, Object param2); + @Message(id = 68, value = "{0} method {1} is not a business method of {2}\n\tat {3}\n StackTrace:", format = Format.MESSAGE_FORMAT) + DefinitionException methodNotBusinessMethod(Object methodType, Object param1, Object param2, Object stackElement); @Message(id = 70, value = "Simple bean {0} cannot be a non-static inner class", format = Format.MESSAGE_FORMAT) DefinitionException simpleBeanAsNonStaticInnerClassNotAllowed(Object param1);