2 Replies Latest reply on Jun 19, 2007 6:14 PM by Clebert Suconic

    javax.jms.IllegalStateException vs java.lang.IllegalStateExc

    Clebert Suconic Master

      I'm trying to keep JORAM tests discussions under "Invalid JORAM Test" thread, but I wanted to open this one here to start a new discussion.


      According to this test, we should be throwing javax.jms.IllegalStateException, but JBossConnection is actually throwing java.lang.IllegalStateException, causing the test to fail.


       /**
       * Test that a call to <code>createDurableConnectionConsumer()</code> method
       * on a <code>QueueConnection</code> throws a
       * <code>javax.jms.IllegalStateException</code>.
       * (see JMS 1.1 specs, table 4-1).
       *
       * @since JMS 1.1
       */
       public void testCreateDurableConnectionConsumerOnQueueConnection()
       {
       try
       {
       queueConnection.createDurableConnectionConsumer(topic, "subscriptionName", "", (ServerSessionPool) null, 1);
       fail("Should throw a javax.jms.IllegalStateException");
       }
       catch (javax.jms.IllegalStateException e)
       {
       }
       catch (JMSException e)
       {
       fail("Should throw a javax.jms.IllegalStateException, not a " + e);
       }
       }
      


      On the JMS spec, at section 7.3, JMS defines IllegalStateException. From that I read we should be aways throwing javax.jms.IllegalStateException... but from what I inspected on code, we aways use java.lang.IllegalStateException.

      Should we change this?