users@jms-spec.java.net

[jms-spec users] [jsr343-experts] (JMS_SPEC-106) Methods on JMSContext that are disallowed if the context is injected should throw a IllegalStateException not a JMSException

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Wed, 14 Nov 2012 15:19:06 +0000

I have logged this JIRA issue
http://java.net/jira/browse/JMS_SPEC-106
Methods on JMSContext that are disallowed if the context is injected should throw a IllegalStateException not a JMSException

This is a trivial change but since it is to an otherwise "finished" (and implemented) API I'm raising this as separate
issue.

Section 11.3.5. "Restrictions on use of injected JMSContext objects" of the draft JMS 2.0 specification lists some
methods which may not be used if the JMSContext is injected (container-managed). It specifies that these methods must
throw a JMSRuntimeException if the JMSContext is injected.

A better exception to throw would be an IllegalStateRuntimeException since the error is caused by the JMSContext being
"in the wrong state" (container-managed). Note that since IllegalStateRuntimeException is a subtype of
JMSRuntimeException anyway.

I don't want to waste the EG's valuable time with minutiae like this, so I'm not asking for comments on this (though
speak up if you want to). I'm just going to go ahead with this.

Nigel