[jboss-cvs] JBossAS SVN: r63211 - branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 25 15:14:29 EDT 2007


Author: weston.price at jboss.com
Date: 2007-05-25 15:14:29 -0400 (Fri, 25 May 2007)
New Revision: 63211

Modified:
   branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java
Log:
[JBCTS-588] As per the JMS specification, an IllegalStateException should be 
thrown when certain methods are used against the wrong messaging domain
type. JMS 1.1 specification Sections 11.2.

Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java	2007-05-25 15:40:11 UTC (rev 63210)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java	2007-05-25 19:14:29 UTC (rev 63211)
@@ -271,6 +271,11 @@
 
    public Topic createTopic(String topicName) throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.QUEUE)
+      {
+         throw new IllegalStateException("Cannot create topic for javax.jms.QueueSession");         
+      }
+
       Session session = getSession();
       if (trace)
          log.trace("createTopic " + session + " topicName=" + topicName);
@@ -308,6 +313,11 @@
 
    public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.QUEUE)
+      {
+         throw new IllegalStateException("Cannot create durable subscriber from javax.jms.QueueSession");         
+      }
+      
       TopicSession session = getTopicSession();
       if (trace)
          log.trace("createDurableSubscriber " + session + " topic=" + topic + " name=" + name);
@@ -347,6 +357,11 @@
 
    public TemporaryTopic createTemporaryTopic() throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.QUEUE)
+      {
+         throw new IllegalStateException("Cannot create temporary topic for javax.jms.QueueSession");         
+      }
+      
       Session session = getSession();
       if (trace)
          log.trace("createTemporaryTopic " + session);
@@ -359,6 +374,11 @@
 
    public void unsubscribe(String name) throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.QUEUE)
+      {
+         throw new IllegalStateException("Cannot unsubscribe for javax.jms.QueueSession");         
+      }
+
       Session session = getSession();
       if (trace)
          log.trace("unsubscribe " + session + " name=" + name);
@@ -369,6 +389,13 @@
 
    public QueueBrowser createBrowser(Queue queue) throws JMSException
    {
+      
+      if(info.getType() == JmsConnectionFactory.TOPIC)
+      {
+         throw new IllegalStateException("Cannot create browser for javax.jms.TopicSession");
+         
+      }
+
       Session session = getSession();
       if (trace)
          log.trace("createBrowser " + session + " queue=" + queue);
@@ -391,6 +418,12 @@
 
    public Queue createQueue(String queueName) throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.TOPIC)
+      {
+         throw new IllegalStateException("Cannot create browser or javax.jms.TopicSession");
+         
+      }
+
       Session session = getSession();
       if (trace)
          log.trace("createQueue " + session + " queueName=" + queueName);
@@ -440,6 +473,11 @@
 
    public TemporaryQueue createTemporaryQueue() throws JMSException
    {
+      if(info.getType() == JmsConnectionFactory.TOPIC)
+      {
+         throw new IllegalStateException("Cannot create temporary queue for javax.jms.TopicSession");
+         
+      }
       Session session = getSession();
       if (trace)
          log.trace("createTemporaryQueue " + session);




More information about the jboss-cvs-commits mailing list