jsr343-experts@jms-spec.java.net

[jsr343-experts] Re: (JMS_SPEC-35) Remove the use of unchecked exceptions from the JMS API as far as possible

From: <reza_rahman_at_lycos.com>
Date: Thu, 20 Oct 2011 19:35:01 +0000 (GMT)
Personally, I think this an acceptable risk.

Oct 20, 2011 12:39:20 PM, jsr343-experts@jms-spec.java.net wrote:
OK, remember this one?
http://java.net/jira/browse/JMS_SPEC-35

> "It is therefore proposed that the JSR 343 Expert Group consider whether they should change the JMS API to throw
> unchecked rather than checked exceptions as much as possible. One simple way of achieving this would be to change
> {{javax.jms.JMSException}} to extend {{java.lang.RuntimeException}} instead of {{java.lang.Exception}}.
>
> "Existing applications which explicitly catch {JMSException}}s would not need to be changed. "

A colleague has pointed out a case where this change would change the behaviour of existing binary code, and prevent the
source code compiling.

try {
a{};
} catch (RuntimeException rte){
b{};
} catch (MyException e) {
c();
}

In JMS 1.1, if a JMSException in throw in a(), then c() will be called. However if JMSException is changed as proposed
above, b() will be called. Also, the above code will not compile because c() is unreachable.

It is possible to contrive similar cases, but I think the above is quite a plausible existing use case.

This means that we cannot guarantee that this change will never change existing application behaviour, and will never
require application code changes.

I think this probably means we can't make this change in JMS 2.0. Which is a pity.

Nigel