Qpid
  1. Qpid
  2. QPID-4608

JMS client authorization failure throws JMSException instead of JMSSecurityException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.18, 0.20
    • Fix Version/s: 0.21
    • Component/s: Java Client
    • Labels:

      Description

      When ACLs doen't authorize a user to perform an action, Java client raises JMSException while JMSSecurityException should be raised.

      From the java docs for JMSSecurityException,

      "This exception must be thrown when a provider rejects a user name/password submitted by a client. It may also be thrown for any case where a security restriction prevents a method from completing."

        Activity

        Hide
        Alex Rudyy added a comment -

        Hi Rajith,

        I would like to point out that your commit http://svn.apache.org/r1451047 changed the exception handling in AMQSession#createTemporaryQueue().

        @@ -1434,12 +1432,9 @@
                             new FieldTable(), result.getExchangeName(), result);
                     return result;
                 }
        -        catch (Exception e)
        +        catch (AMQException e)
                 {
        -           JMSException jmse = new JMSException("Cannot create temporary queue");
        -           jmse.setLinkedException(e);
        -           jmse.initCause(e);
        -           throw jmse;
        +           throw toJMSException("Cannot create temporary queue",e);
                 }
             }
         
        

        This method can potentially throw FailoverException and runtime exceptions like TransportException etc. IMHO, this changes the behaviour of the client. I would like to suggest to add code to re-throw theses exceptions as JMSException as it used to be.

        Show
        Alex Rudyy added a comment - Hi Rajith, I would like to point out that your commit http://svn.apache.org/r1451047 changed the exception handling in AMQSession#createTemporaryQueue(). @@ -1434,12 +1432,9 @@ new FieldTable(), result.getExchangeName(), result); return result; } - catch (Exception e) + catch (AMQException e) { - JMSException jmse = new JMSException( "Cannot create temporary queue" ); - jmse.setLinkedException(e); - jmse.initCause(e); - throw jmse; + throw toJMSException( "Cannot create temporary queue" ,e); } } This method can potentially throw FailoverException and runtime exceptions like TransportException etc. IMHO, this changes the behaviour of the client. I would like to suggest to add code to re-throw theses exceptions as JMSException as it used to be.
        Hide
        Rajith Attapattu added a comment -

        Alex,

        I will add code to catch FailoverException and TransportException and to throw them as JMSExceptions.

        Regards,

        Rajith

        Show
        Rajith Attapattu added a comment - Alex, I will add code to catch FailoverException and TransportException and to throw them as JMSExceptions. Regards, Rajith
        Hide
        Rajith Attapattu added a comment -

        I have now added code to handle the TransportException and any RuntimeException that could be thrown.
        FailoverException is not thrown as it's a checked exception and not a runtime exception.

        Show
        Rajith Attapattu added a comment - I have now added code to handle the TransportException and any RuntimeException that could be thrown. FailoverException is not thrown as it's a checked exception and not a runtime exception.
        Show
        Rajith Attapattu added a comment - The relevant commits are http://svn.apache.org/viewvc?view=revision&revision=r1451047 http://svn.apache.org/viewvc?view=revision&revision=1451362

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development