[wildfly-dev] Return types of i18n logging methods and their "equality" expectations

James R. Perkins jperkins at redhat.com
Sat Apr 27 11:41:03 EDT 2013


Not that wouldn't work. Each invocation of fooBar() will return a new 
instance of SomeException.

Why not just do

try {
     doSomething();
} catch (SomeException e) {
     // handle
} catch (Exception e) {
     // do something else
}

On 04/27/2013 06:17 AM, Jaikiran Pai wrote:
> I have a interface annotated with @MessageBundle which has a method:
>
> @Message(id = xxxx, value = "No param message")
> SomeException fooBar();
>
>
> So the method expects no format params for the log message and returns a
> "SomeException" type. Assuming some piece of code then uses this logging
> method to do:
>
> throw fooBar();
>
> is it fine to expect that if the caller does:
>
> try {
>       ...
>      doSomething();
> } catch (Exception e) {
>       // is this fine to do?
>       if (e.equals(fooBar()) {
>           // do some other thing
>       }
> }
>
> I think the equals and even == would work for the no param logger
> method, but is this considered as relying/guessing about the
> implementation details or is this fine to do?
>
> -Jaikiran
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev

-- 
James R. Perkins
JBoss by Red Hat



More information about the wildfly-dev mailing list