[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16283797#comment-16283797 ] clebert suconic commented on ARTEMIS-1545: -- this IRC chat may be relevant: [11:00am] clebert: michaelandrepear: the ACKHandler is based on confirmations…. [11:00am] clebert: which is part of the protocol on core... [11:01am] • clebert still looking [11:01am] clebert: that’s called through : ActiveMQSessionContext:: CommandConfirmationHandler [11:02am] clebert: michaelandrepear: ^ [11:02am] • clebert still looking into something... [11:09am] clebert: michaelandrepear: looking at ServerSessionPacketHandler… onSessionSend... [11:09am] clebert: senndResponse would be called with an exception... [11:09am] clebert: (even if it’s asynchronous) [11:09am] clebert: on that case with requiresResponse = false [11:09am] clebert: on the client. [11:09am] • clebert looking again.. hold on [11:11am] clebert: ActiveMQSessionContext:: [11:11am] clebert: line 899 [11:11am] clebert: is that log being throwed at the client? [11:11am] clebert: we could feed the Exception Handler there... [11:12am] clebert: so.. we need to make sure the ServerSessionPacketHandler would throw the exception to the client [11:12am] clebert: and that the ActiveMQessionContext::handlePacket [11:12am] clebert: would put this exception at the right place on the session... [11:12am] clebert: this seems to be coming correctly at the ChannelPacketHandler.. which belongs to the session [11:13am] clebert: michaelandrepear: I think that answers what we would need to here… but this is the 5% of inspiration.. putting this to work will be some work! [11:13am] clebert: michaelandrepear: more on testing [11:13am] clebert: michaelandrepear: wdyt? [11:13am] michaelandrepear: (sorry disconnected, but just catching up) [11:13am] michaelandrepear: (dont worry i have the full chat) [11:15am] michaelandrepear: ok, so i think i understand, ill have to step through the code on debug to undertsand fully [11:15am] michaelandrepear: but thanks its a good starter for ten [11:16am] clebert: michaelandrepear: I would need to debug more as well [11:16am] clebert: michaelandrepear: but this is where I would start [11:17am] michaelandrepear: @clebert we will need to somehow get that tied back also to the completionlistener [11:19am] michaelandrepear: @clebert just thinking aloud [11:19am] clebert: I agree [11:19am] clebert: michaelandrepear: [11:19am] clebert: michaelandrepear: I agree [11:19am] clebert: michaelandrepear: just realized how [11:19am] clebert: if sessionChannel.getConfrmationHandler != null [11:20am] clebert: add a method to CommandConfirmationHandler [11:20am] clebert: and deletgate that to the confirmationListener [11:20am] clebert: michaelandrepear: it would be nice to have these somewhere… JIRA perhaps? [11:20am] clebert: michaelandrepear: do you have a JIRA for this? [11:21am] michaelandrepear: @clebert i have the original jira for the PR i made but that was specific about getting exception thrown [11:21am] michaelandrepear: @clebert i think this is slightly different so will raise a new one a bit more specific [11:21am] clebert: michaelandrepear: I would perhaps rename that JIRA [11:21am] clebert: recycle ID [11:21am] clebert: as the intention was this > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is as expected and a Security exception is > thrown. The same behaviour should be expected when sending non-persistent, by > default. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connect
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16292882#comment-16292882 ] ASF GitHub Bot commented on ARTEMIS-1545: - GitHub user michaelandrepearce opened a pull request: https://github.com/apache/activemq-artemis/pull/1722 (WIP DO NOT MERGE) ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions @clebertsuconic id like some feedback on this whilst I'm still developing it, if thats ok. Some bits i need to sort still (inc tests), and back compatibility where new client connects to old broker (I've put TODO's in code where i can handle this once i know how to do this check). Could you have a look over and detail bits you spot that need more thought, or need to address. Cheers Mike You can merge this pull request into a Git repository by running: $ git pull https://github.com/michaelandrepearce/activemq-artemis ARTEMIS-1545-DEC Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/1722.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1722 commit 5353ab548937209fb269ffbcc82e55fa8a168b0f Author: Michael André Pearce Date: 2017-12-14T07:47:30Z ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.1
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16292895#comment-16292895 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @mtaylor also if you get a chance to give any early feedback > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16292907#comment-16292907 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user tabish121 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157260287 --- Diff: tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java --- @@ -169,6 +180,71 @@ public void testLoginInvalidUserInvalidPassword() throws Exception { } } + /** +* Login with valid user and password +* But try send to address not authorised - Persistent +* Should not allow and should throw exception +*/ + @Test + public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws Exception { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); + Connection connection = connectionFactory.createConnection("guest", "guest"); + Session session = connection.createSession(); + Destination destination = session.createQueue("guest.cannot.send"); + MessageProducer messageProducer = session.createProducer(destination); + try { + messageProducer.send(session.createTextMessage("hello")); + fail("JMSSecurityException expected as guest is not allowed to send"); + } catch (JMSSecurityException activeMQSecurityException) { + //pass + } + connection.close(); + } + + /** +* Login with valid user and password +* But try send to address not authorised - Non Persistent. +* Should have same behaviour as Persistent with exception on send. +*/ + @Test + public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws Exception { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); + connectionFactory.setConfirmationWindowSize(100); + connectionFactory.setBlockOnDurableSend(false); + connectionFactory.setBlockOnNonDurableSend(false); + Connection connection = connectionFactory.createConnection("guest", "guest"); + Session session = connection.createSession(); + Destination destination = session.createQueue("guest.cannot.send"); + MessageProducer messageProducer = session.createProducer(destination); + messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + try { + AtomicReference e = new AtomicReference<>(); + // messageProducer.send(session.createTextMessage("hello")); + + CountDownLatch countDownLatch = new CountDownLatch(1); + messageProducer.send(session.createTextMessage("hello"), new CompletionListener() { +@Override +public void onCompletion(Message message) { + countDownLatch.countDown(); +} + +@Override +public void onException(Message message, Exception exception) { + countDownLatch.countDown(); + e.set(exception); --- End diff -- The set here should occur prior to the countDown to avoid potential race on the later check of error state. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Sh
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16293702#comment-16293702 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r15733 --- Diff: tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java --- @@ -169,6 +180,71 @@ public void testLoginInvalidUserInvalidPassword() throws Exception { } } + /** +* Login with valid user and password +* But try send to address not authorised - Persistent +* Should not allow and should throw exception +*/ + @Test + public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws Exception { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); + Connection connection = connectionFactory.createConnection("guest", "guest"); + Session session = connection.createSession(); + Destination destination = session.createQueue("guest.cannot.send"); + MessageProducer messageProducer = session.createProducer(destination); + try { + messageProducer.send(session.createTextMessage("hello")); + fail("JMSSecurityException expected as guest is not allowed to send"); + } catch (JMSSecurityException activeMQSecurityException) { + //pass + } + connection.close(); + } + + /** +* Login with valid user and password +* But try send to address not authorised - Non Persistent. +* Should have same behaviour as Persistent with exception on send. +*/ + @Test + public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws Exception { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); + connectionFactory.setConfirmationWindowSize(100); + connectionFactory.setBlockOnDurableSend(false); + connectionFactory.setBlockOnNonDurableSend(false); + Connection connection = connectionFactory.createConnection("guest", "guest"); + Session session = connection.createSession(); + Destination destination = session.createQueue("guest.cannot.send"); + MessageProducer messageProducer = session.createProducer(destination); + messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + try { + AtomicReference e = new AtomicReference<>(); + // messageProducer.send(session.createTextMessage("hello")); + + CountDownLatch countDownLatch = new CountDownLatch(1); + messageProducer.send(session.createTextMessage("hello"), new CompletionListener() { +@Override +public void onCompletion(Message message) { + countDownLatch.countDown(); +} + +@Override +public void onException(Message message, Exception exception) { + countDownLatch.countDown(); + e.set(exception); --- End diff -- good spot, thanks. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void test
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294816#comment-16294816 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user mtaylor commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @michaelandrepearce In general I think this looks good. The only thing I am not seeing here is backwards compat between the new client and an old server. There are two ways you can easily handle this: 1. Instead of creating new SessionSend V2 Packets, you can just extend the old one and add the extra bits at the end of the buffer. This would mean the old server can still decode the message. (It would just ignore the last couple bytes). 2. Check to see if the server version >= 130 and create the appropriate packets. @clebertsuconic has just ported/extended a backwards compat framework in another PR. Once this is merged you should be able to easily test for this. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294837#comment-16294837 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157459675 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java --- @@ -42,6 +42,21 @@ default int expectedEncodeSize() { return INITIAL_PACKET_SIZE; } + default boolean isRequiresResponse() { --- End diff -- be careful to use `default` method on hottest paths vs common abstract methods on superclass: they lack CHA AFAIK! http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2015-April/thread.html#17649 and https://stackoverflow.com/questions/30312096/java-default-methods-is-slower-than-the-same-code-but-in-an-abstract-class > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294910#comment-16294910 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 I would like to see a compatibility test added on the testsuite I’m working on. I can help with that. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294954#comment-16294954 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157483149 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { --- End diff -- The `IntUnaryOperator` must be side effect free (it seems not due to `sequence.incrementAndGet` or am I wrong?) because it may be retried due to contention: [AtomicInteger::getAndUpdate](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html#getAndUpdate-java.util.function.IntUnaryOperator-). If this `ResponseCache` is (or could be turned into) a `single-writer` cache my suggestion is to avoid complex (and expensive) logic here > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } cat
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294958#comment-16294958 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157484426 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { + Packet p = store[operand]; + if (p != null) { +return operand; + } + packet.setCorrelationID(correlationID(operand, sequence.incrementAndGet())); + store[operand] = packet; + return operand + 1 == store.length ? 0 : operand + 1; + }); + + if (pointer(packet.getCorrelationID()) != pointer) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + + return packet.getCorrelationID(); + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + int pointer = pointer(correlationID); + if (pointer > -1 && pointer < store.length) { + Packet p = store[pointer]; + if (p != null && p.getCorrelationID() == correlationID) { +store[pointer] = null; + } + if (responseHandler != null) { +responseHandler.responseHandler(p, response); + } + } + } + + public long correlationID(int pointer, int sequence) { --- End diff -- I would make this method static and uses `(pointer & 0x_L) << 32` to make explicit what is happing during the upcast > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294962#comment-16294962 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157484746 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java --- @@ -42,6 +42,21 @@ default int expectedEncodeSize() { return INITIAL_PACKET_SIZE; } + default boolean isRequiresResponse() { --- End diff -- good point, ill move to PacketImpl the default behaviour. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294961#comment-16294961 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157484631 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { + Packet p = store[operand]; + if (p != null) { +return operand; + } + packet.setCorrelationID(correlationID(operand, sequence.incrementAndGet())); + store[operand] = packet; + return operand + 1 == store.length ? 0 : operand + 1; + }); + + if (pointer(packet.getCorrelationID()) != pointer) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + + return packet.getCorrelationID(); + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + int pointer = pointer(correlationID); + if (pointer > -1 && pointer < store.length) { + Packet p = store[pointer]; + if (p != null && p.getCorrelationID() == correlationID) { +store[pointer] = null; + } + if (responseHandler != null) { +responseHandler.responseHandler(p, response); + } + } + } + + public long correlationID(int pointer, int sequence) { + long l = (((long)pointer) << 32) | (sequence & 0xL); + return l; + } + + public int pointer(long l) { + return (int)(l >> 32); --- End diff -- I would use `>>>` here > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/a
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294979#comment-16294979 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157485298 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java --- @@ -115,6 +123,8 @@ public Packet decode(final ActiveMQBuffer in) { switch (packetType) { case SESS_SEND: return decodeSessionSendMessage(in); + case SESS_SEND_V2: +return decodeSessionSendMessageV2(in); --- End diff -- If decodeSessionSendMessageV2 is not supposed to be the common case here, would be better to move it on the `slowPathDecode` instead > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294983#comment-16294983 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157485654 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { --- End diff -- I want to avoid having a lock like bad here, thus this. If there is retry done here it would simply set the packet at a new location in the array. And the one that won in the contention would be left set at the other. Any ideas what to do here instead? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to addre
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294988#comment-16294988 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157486228 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java --- @@ -115,6 +123,8 @@ public Packet decode(final ActiveMQBuffer in) { switch (packetType) { case SESS_SEND: return decodeSessionSendMessage(in); + case SESS_SEND_V2: +return decodeSessionSendMessageV2(in); --- End diff -- it is common case, it will replace SESS_SEND > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294989#comment-16294989 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @mtaylor i was thinking on option 2, because i didn't know i could safely do option 1, are you confirming it would be safe to do that then? If so Bingo, I'm doing option 1 :) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294991#comment-16294991 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @clebertsuconic agreed, need some more tests, i was waiting a little like @mtaylor and yourself have said for you're PR to merge first, as ill have some conflicts ill need to sort as well when i rebase. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295004#comment-16295004 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157487888 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java --- @@ -115,6 +123,8 @@ public Packet decode(final ActiveMQBuffer in) { switch (packetType) { case SESS_SEND: return decodeSessionSendMessage(in); + case SESS_SEND_V2: +return decodeSessionSendMessageV2(in); --- End diff -- This will clash with my changes... that's about to be merged today. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295007#comment-16295007 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user mtaylor commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 1. Should be fine. Just add an if when you're decoding to check that there's data on the buffer when you're decoding. If yes, try to decode the rest, if not then set the defaults. I've done this a lot in the past with journal records, I can't see an issue with doing on it with Packets either. @clebertsuconic Can you see a problem with this? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295008#comment-16295008 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157488380 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java --- @@ -115,6 +123,8 @@ public Packet decode(final ActiveMQBuffer in) { switch (packetType) { case SESS_SEND: return decodeSessionSendMessage(in); + case SESS_SEND_V2: +return decodeSessionSendMessageV2(in); --- End diff -- Thats fine, any clashes i will sort when i rebase, I'm kinda holding off doing any further work right now until you're merges tbh. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295052#comment-16295052 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157496805 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { --- End diff -- It depends on how it is accessed by concurrent writers ie `handleResponse` and `add` could be accessed by different threads concurrently? Dealing with concurrent accesses here could be dangerous: If multiple threads are accessing concurrently `Packet[]` and the references are not padded by 128 bytes (ie 4 object references between the `Packet` references in the array) the cache won't scale due to false sharing > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityExcepti
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296686#comment-16296686 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @mtaylor just FYI i actually went with option 2, because after rebasing with @clebertsuconic 's changes for compatibility he had followed this option, as such i follow suit, rather than having two different ways to do it. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296688#comment-16296688 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157736217 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java --- @@ -115,6 +123,8 @@ public Packet decode(final ActiveMQBuffer in) { switch (packetType) { case SESS_SEND: return decodeSessionSendMessage(in); + case SESS_SEND_V2: +return decodeSessionSendMessageV2(in); --- End diff -- I have rebased and sorted, was easy to fix, but thanks for the warning @clebertsuconic > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296690#comment-16296690 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157736414 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/Packet.java --- @@ -42,6 +42,21 @@ default int expectedEncodeSize() { return INITIAL_PACKET_SIZE; } + default boolean isRequiresResponse() { --- End diff -- done > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296689#comment-16296689 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157736374 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; + +public class ResponseCache { + + private final AtomicInteger writerPointer = new AtomicInteger(0); + private final AtomicInteger sequence = new AtomicInteger(0); + + private final Packet[] store; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new Packet[size]; + } + + public long add(Packet packet) { + int pointer = writerPointer.getAndUpdate(operand -> { --- End diff -- endedup just making a simpler solution using the already existing and tested ConcurrentLongHashMap we have, made all this a lot simpler. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296731#comment-16296731 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @clebertsuconic on compatibility test front, i went to check the existing test and it seems for the two new packets the client will send for this (SESS_SEND_V2 and SESS_SEND_CONTINUATION_V2), these flow's are already covered including the ack (also they correctly failed, until i implemented the compatibility change bits i had left outstanding - now implemented) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296743#comment-16296743 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157743906 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; +import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap; + +public class ResponseCache { + + private final AtomicLong sequence = new AtomicLong(0); + + private final ConcurrentLongHashMap store; + private final int size; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new ConcurrentLongHashMap<>(size); + this.size = size; + } + + public long add(Packet packet) { + if (store.size() + 1 > size) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + long correlationID = sequence.incrementAndGet(); + packet.setCorrelationID(correlationID); + this.store.put(correlationID, packet); + return correlationID; + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + Packet packet = store.get(correlationID); --- End diff -- Would be better to just use `store::remove` that return the current value (if any) of the `correlationID` key > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destinatio
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296754#comment-16296754 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157746259 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; +import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap; + +public class ResponseCache { + + private final AtomicLong sequence = new AtomicLong(0); + + private final ConcurrentLongHashMap store; + private final int size; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new ConcurrentLongHashMap<>(size); + this.size = size; + } + + public long add(Packet packet) { + if (store.size() + 1 > size) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + long correlationID = sequence.incrementAndGet(); + packet.setCorrelationID(correlationID); + this.store.put(correlationID, packet); + return correlationID; + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + Packet packet = store.get(correlationID); --- End diff -- oops, this was actually what i did originally, i had an issue of correlationID not being set, so added this to debug, but forgot to revert, good spotting it. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessagePr
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296761#comment-16296761 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157748076 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; +import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap; + +public class ResponseCache { + + private final AtomicLong sequence = new AtomicLong(0); + + private final ConcurrentLongHashMap store; + private final int size; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new ConcurrentLongHashMap<>(size); + this.size = size; + } + + public long add(Packet packet) { + if (store.size() + 1 > size) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + long correlationID = sequence.incrementAndGet(); + packet.setCorrelationID(correlationID); + this.store.put(correlationID, packet); + return correlationID; + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + Packet packet = store.get(correlationID); --- End diff -- Well done, provided that there aren't memory leaks on `Packet` for me is ok: just take some time (I will try for sure) to bench if it can cause any regressions with a scale stress test, just in case! > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296768#comment-16296768 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1722#discussion_r157749643 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ResponseCache.java --- @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl; + +import java.util.concurrent.atomic.AtomicLong; + +import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; +import org.apache.activemq.artemis.core.protocol.core.Packet; +import org.apache.activemq.artemis.core.protocol.core.ResponseHandler; +import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap; + +public class ResponseCache { + + private final AtomicLong sequence = new AtomicLong(0); + + private final ConcurrentLongHashMap store; + private final int size; + private ResponseHandler responseHandler; + + public ResponseCache(int size) { + this.store = new ConcurrentLongHashMap<>(size); + this.size = size; + } + + public long add(Packet packet) { + if (store.size() + 1 > size) { + throw new ActiveMQInterruptedException("unable to send due to buffer full"); + } + long correlationID = sequence.incrementAndGet(); + packet.setCorrelationID(correlationID); + this.store.put(correlationID, packet); + return correlationID; + } + + public void handleResponse(Packet response) { + long correlationID = response.getCorrelationID(); + Packet packet = store.get(correlationID); --- End diff -- please do! More hands and eyes == less issues :) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(ses
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297356#comment-16297356 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user asfgit closed the pull request at: https://github.com/apache/activemq-artemis/pull/1722 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297354#comment-16297354 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 9b982b3e303067cec8cac277a19a3ab3c63a1a9f in activemq-artemis's branch refs/heads/master from [~michael.andre.pearce] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=9b982b3 ] ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297355#comment-16297355 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 8f5b7a1e73164f7b7867872a77d74f13176a5af5 in activemq-artemis's branch refs/heads/master from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=8f5b7a1 ] ARTEMIS-1545 Adding HornetQ 2.4.7 on the mesh to validate send-acks > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297366#comment-16297366 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @michaelandrepearce I merged this.. but I just realized an issue. When you run regular sends.. you don't even need different versions... you will see this: ``` [Thread-6 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5@71075444)] 15:12:26,056 WARN [org.apache.activemq.artemis.core.server] AMQ222165: No Dead Letter Address configured for queue queue in AddressSettings [Thread-6 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5@71075444)] 15:12:26,056 WARN [org.apache.activemq.artemis.core.server] AMQ222166: No Expiry Address configured for queue queue in AddressSettings Sending messages [main] 15:12:26,321 WARN [org.apache.activemq.artemis.core.client] AMQ212052: Packet PACKET(SuccessResponseMessage)[type=23, channelID=11, packetObject=SuccessResponseMessage, correlationID=16] was answered out of sequence due to a previous server timeout and it's being ignored: java.lang.Exception: trace at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:417) [:] at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:341) [:] at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.simpleCommit(ActiveMQSessionContext.java:401) [:] at org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.commit(ClientSessionImpl.java:791) [:] at org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.commit(ClientSessionImpl.java:764) [:] at org.apache.activemq.artemis.jms.client.ActiveMQSession.commit(ActiveMQSession.java:230) [:] at javax.jms.Session$commit$6.call(Unknown Source) [:1.0-alpha-2] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) [groovy-all-2.4.3.jar:2.4.3] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) [groovy-all-2.4.3.jar:2.4.3] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:114) [groovy-all-2.4.3.jar:2.4.3] at meshTest.sendMessages.run(sendMessages.groovy:102) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589) [groovy-all-2.4.3.jar:2.4.3] at groovy.lang.GroovyShell.evaluate(GroovyShell.java:645) [groovy-all-2.4.3.jar:2.4.3] at org.apache.activemq.artemis.tests.compatibility.GroovyRun.evaluate(GroovyRun.java:66) [:] at org.apache.activemq.artemis.tests.compatibility.GroovyRun.doMain(GroovyRun.java:45) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_73] at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_73] at org.apache.activemq.artemis.tests.compatibility.VersionedBaseTest.lambda$callMain$0(VersionedBaseTest.java:115) [:] at org.apache.activemq.artemis.tests.compatibility.VersionedBaseTest.tclCall(VersionedBaseTest.java:132) [:] at org.apache.activemq.artemis.tests.compatibility.VersionedBaseTest.callMain(VersionedBaseTest.java:112) [:] at org.apache.activemq.artemis.tests.compatibility.MeshTest.testSendReceive(MeshTest.java:74) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_73] at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_73] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.11.jar:] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.11.jar:] at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.11.jar:] at org.junit.runners.Paren
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297394#comment-16297394 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @michaelandrepearce I'm sending a PR for your review > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297396#comment-16297396 ] ASF GitHub Bot commented on ARTEMIS-1545: - GitHub user clebertsuconic opened a pull request: https://github.com/apache/activemq-artemis/pull/1732 ARTEMIS-1545 Adding ignore statement on blocked calls You can merge this pull request into a Git repository by running: $ git pull https://github.com/clebertsuconic/activemq-artemis ARTEMIS-1545 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/1732.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1732 commit cbb97d0253ee6b3adee99302e6413f6481247f54 Author: Clebert Suconic Date: 2017-12-19T20:36:11Z ARTEMIS-1545 Adding ignore statement on blocked calls > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297399#comment-16297399 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1732 @michaelandrepearce can you review this please? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297496#comment-16297496 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic closed the pull request at: https://github.com/apache/activemq-artemis/pull/1732 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297497#comment-16297497 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1722 @michaelandrepearce I will revert this PR... it's breaking the testsuite really badly.. Can you send it back again, so we work through the issues? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297504#comment-16297504 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 7514e91ed1af3b0586903426c8532728ef3e0912 in activemq-artemis's branch refs/heads/master from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=7514e91 ] Revert "ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions" Revert "ARTEMIS-1545 Adding HornetQ 2.4.7 on the mesh to validate send-acks" I'm reverting this as the testsuite is broken.. We will send it back once worked out. This reverts commit 8f5b7a1e73164f7b7867872a77d74f13176a5af5. This reverts commit 9b982b3e303067cec8cac277a19a3ab3c63a1a9f. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297506#comment-16297506 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 7514e91ed1af3b0586903426c8532728ef3e0912 in activemq-artemis's branch refs/heads/master from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=7514e91 ] Revert "ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions" Revert "ARTEMIS-1545 Adding HornetQ 2.4.7 on the mesh to validate send-acks" I'm reverting this as the testsuite is broken.. We will send it back once worked out. This reverts commit 8f5b7a1e73164f7b7867872a77d74f13176a5af5. This reverts commit 9b982b3e303067cec8cac277a19a3ab3c63a1a9f. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297545#comment-16297545 ] ASF GitHub Bot commented on ARTEMIS-1545: - GitHub user michaelandrepearce opened a pull request: https://github.com/apache/activemq-artemis/pull/1733 ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions @clebertsuconic re-sending so we can work through You can merge this pull request into a Git repository by running: $ git pull https://github.com/michaelandrepearce/activemq-artemis ARTEMIS-1545-DEC Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/1733.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1733 commit d214e8acc17214d0d7024e4bdc41193b35499782 Author: Michael André Pearce Date: 2017-12-14T07:47:30Z ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297567#comment-16297567 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1732 @clebertsuconic this shouldn't be ignored. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297568#comment-16297568 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @clebertsuconic https://builds.apache.org/job/ActiveMQ-Artemis-PR-Build/4660/ full test suite passed, what issue did you see? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297579#comment-16297579 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 The Pr build is not the full the testsuite. I ran mvn test -Ptests > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300337#comment-16300337 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 The full testsuite is stale on this... On my personal CI box, when I run the following grep: http://my-ci-box:8080/view/Artemis/job/novm-artemis-param/2294/consoleText ``` curl -s --insecure -0 http://my-ci-box:8080/view/Artemis/job/novm-artemis-param/2294/consoleText | grep -a -e "222105" -e Running -e "Tests run" -e "Finished Test" -e "Run test" -e "Start test" -e "Stop test" ``` I see the following: ``` Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.103 sec - in org.apache.activemq.artemis.tests.integration.client.JMSMessageCounterTest Running org.apache.activemq.artemis.tests.integration.client.JMSPagingFileDeleteTest Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 31.121 sec <<< FAILURE! - in org.apache.activemq.artemis.tests.integration.client.JMSPagingFileDeleteTest Running org.apache.activemq.artemis.tests.integration.client.JmsNettyNioStressTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.205 sec - in org.apache.activemq.artemis.tests.integration.client.JmsNettyNioStressTest Running org.apache.activemq.artemis.tests.integration.client.JournalCrashTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.646 sec - in org.apache.activemq.artemis.tests.integration.client.JournalCrashTest Running org.apache.activemq.artemis.tests.integration.client.LargeMessageAvoidLargeMessagesTest `` > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { >
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300497#comment-16300497 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @clebertsuconic sorry could you expand on what you mean by the test suite is stale on this. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300513#comment-16300513 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @michaelandrepearce it hangs on that test.. never finish.. freezes on that last test. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313055#comment-16313055 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 Still being worked on, don't merge. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318706#comment-16318706 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit c8dc7de44506745499b830edf3ffec87ff3d0b4b in activemq-artemis's branch refs/heads/master from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=c8dc7de ] ARTEMIS-1545 Fixing compatibility issues with topic Subscriptions > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328480#comment-16328480 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @clebertsuconic did you get a chance to possibly look at whats missing / why those extra tests don't pass with this change, im still struggling to figure it myself > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16329337#comment-16329337 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @michaelandrepearce I promise I will get here by next week :) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338074#comment-16338074 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @michaelandrepearce I rebased and I'm running tests to get a current status.. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338162#comment-16338162 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @michaelandrepearce the error you saw was a LargeMessage test dead locking under JDBC for no apparent connected reason? if that's the case.. I am working on it now. just confirm please? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338335#comment-16338335 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 .. just to say I'm working on it.. getting my head and debugging it.. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338387#comment-16338387 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 I saw it also on the journal one as well. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338389#comment-16338389 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 Also i can’t remember (sorry laptop is no where near me tonight taking some time out tonight) but I remember issue in Bridge test but I was concentrating on this first > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386703#comment-16386703 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 @clebertsuconic nudge nudge wink wink :) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16549908#comment-16549908 ] ASF GitHub Bot commented on ARTEMIS-1545: - GitHub user jbertram opened a pull request: https://github.com/apache/activemq-artemis/pull/2187 ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions You can merge this pull request into a Git repository by running: $ git pull https://github.com/jbertram/activemq-artemis ARTEMIS-1545 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/2187.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2187 commit 74f6f1887e9c3234812d2b0997c97d30164b985e Author: Michael André Pearce Date: 2017-12-14T07:47:30Z ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions commit a2da41ee2e347bcf8fe721bded89e4a78ca14cfb Author: Justin Bertram Date: 2018-07-17T15:53:21Z ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550509#comment-16550509 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/2187 @jbertram left a few comments i am unfortuantly on leave abroad so only a brief view via github diff via phone > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16563252#comment-16563252 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r206422634 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java --- @@ -31,7 +31,8 @@ // 2.0.0 public static final int ADDRESSING_CHANGE_VERSION = 129; - public static final int SHARED_QUEUE_SECURITY_FIX_CHANGE_VERSION = 130; --- End diff -- This was used in version 2.6.1 shouldn't be removed, need to bump the async response change version. (as was made prior to the security fix version) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16563257#comment-16563257 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r206424803 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- This was meant to be either newer response handler or the older command confirm handler. The intent was both shouldn't be set. This may be the reason of your dupes issue, what was this needed still even with the async response change? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564614#comment-16564614 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r206733019 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- @michaelandrepearce is this ready to be merged in your opinion? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564826#comment-16564826 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r206769179 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- I have concern why the handler is getting invoked twice. It shouldnt be possible if its always invoked via the response cache. Interestingly if i take just the changes justin made in the large message method, then the original failing tests pass. So the other changes seem to be not needed but introduce either issue causing the dupe issue that justin encounters and needs the atomic. I think it needs more discussion and development still. The answer is probably somewhere inbetween > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16566753#comment-16566753 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user jbertram commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r207218441 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- I realize that your original intent was that either the confirmation or the response handler would be set here rather than both, and this is definitely the reason for the duplicate confirmation. However, I couldn't determine any other way to maintain compatibility with existing bridge behavior without setting both. If this method is changed back to your original semantic (i.e. only set one) then lots of tests in org.apache.activemq.artemis.tests.integration.cluster.bridge.BridgeTest fail. org.apache.activemq.artemis.tests.integration.client.SendAckFailTest was broken at some point as well. I will certainly admit that my solution here isn't the most elegant, but I haven't found a more clever way of dealing with the failing tests. I think eventually the whole confirmation implementation should be refactored to deal with these issues, but I don't see how that's feasible in a minor release. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is no
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16566846#comment-16566846 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r207235658 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- So issue then will be if you dont handle via the cache, the response handlers will keep reference to it, and would slowley leak memory > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16566893#comment-16566893 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user jbertram commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r207253620 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- I'm not sure I follow you. Write a test to demonstrate? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16570458#comment-16570458 ] ASF GitHub Bot commented on ARTEMIS-1545: - GitHub user michaelandrepearce opened a pull request: https://github.com/apache/activemq-artemis/pull/2217 FOR jbertram - ARTEMIS-1545 Memory leak @jbertram here is what i was trying to explain as a bit of code about the leaking objects in the response cache when relying on the confirmation handler logic, for the missing responses. If we need to do this, then we must handle the response via the response cache. You can merge this pull request into a Git repository by running: $ git pull https://github.com/michaelandrepearce/activemq-artemis Memory Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/2217.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2217 commit 74f6f1887e9c3234812d2b0997c97d30164b985e Author: Michael André Pearce Date: 2017-12-14T07:47:30Z ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions commit a2da41ee2e347bcf8fe721bded89e4a78ca14cfb Author: Justin Bertram Date: 2018-07-17T15:53:21Z ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. commit ffed219e6cd60e9c13f462750c037554c495024f Author: Michael André Pearce Date: 2018-08-06T16:38:05Z Test case to demo, memory/object leak Demonstrate the response cache is not removed when relying on confirm handler, thus holding onto response handlers leaking memory/objects over time. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.cre
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16570460#comment-16570460 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r207957133 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- see https://github.com/apache/activemq-artemis/pull/2217 hopefully this quick test knocked up explains or demo's the issue. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574445#comment-16574445 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r208837845 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- @jbertram So i think to solve the issue of the responseCache still having reference and the memory leak, we can just add in the code that acks the commands upto the latest, we can just also call the cache, it will mean a double invocation but as you noted for the interim with your flag it actually wont have effect. Thought? Ill send a pr in a bit to your branch > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574816#comment-16574816 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce closed the pull request at: https://github.com/apache/activemq-artemis/pull/2217 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574824#comment-16574824 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r208923062 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java --- @@ -189,16 +185,24 @@ public void kill() { this.killed = true; } + private void setHandlers() { + sessionChannel.setCommandConfirmationHandler(commandConfirmationHandler); --- End diff -- https://github.com/jbertram/activemq-artemis/pull/6 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596477#comment-16596477 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user jbertram commented on the issue: https://github.com/apache/activemq-artemis/pull/2187 Getting back to this now after being heads-down on other tasks... @michaelandrepearce, I've included your test and fix in my latest update. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16606660#comment-16606660 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/2187 @jbertram looks good to me. As alot of this is my code, so will wait for others to review and merge (thinking clebert, martyn, franz here) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627999#comment-16627999 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on the issue: https://github.com/apache/activemq-artemis/pull/2187 I'm reviewing this tomorrow. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631060#comment-16631060 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221079593 --- Diff: artemis-core-client/src/main/resources/activemq-version.properties --- @@ -20,4 +20,4 @@ activemq.version.minorVersion=${activemq.version.minorVersion} activemq.version.microVersion=${activemq.version.microVersion} activemq.version.incrementingVersion=${activemq.version.incrementingVersion} activemq.version.versionTag=${activemq.version.versionTag} -activemq.version.compatibleVersionList=121,122,123,124,125,126,127,128,129 --- End diff -- @michaelandrepearce / @jbertram This change here makes it technically a 2.7.0 feature only. Later on if we make other breaking changes into master.. it will be almost impossible to solve compatibility between 2.6.x and master. Are you guys ok with that, or you would look into a way to make a 2.6.x change? > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631062#comment-16631062 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221082377 --- Diff: artemis-core-client/src/main/resources/activemq-version.properties --- @@ -20,4 +20,4 @@ activemq.version.minorVersion=${activemq.version.minorVersion} activemq.version.microVersion=${activemq.version.microVersion} activemq.version.incrementingVersion=${activemq.version.incrementingVersion} activemq.version.versionTag=${activemq.version.versionTag} -activemq.version.compatibleVersionList=121,122,123,124,125,126,127,128,129 --- End diff -- hmmm.. I guess it would be ok though.. we don't have any other changes into activemq-version.properties. That makes it into a simple question then.. is this 2.6.x (yes or no?) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631068#comment-16631068 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit a28b4fb34eb3cc178dd611d0cb2acc51d6b7a965 in activemq-artemis's branch refs/heads/master from [~jbertram] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=a28b4fb ] ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631069#comment-16631069 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit a28b4fb34eb3cc178dd611d0cb2acc51d6b7a965 in activemq-artemis's branch refs/heads/master from [~jbertram] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=a28b4fb ] ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631067#comment-16631067 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit e4ba48a31193ac532404d93b37f29d2720f1a863 in activemq-artemis's branch refs/heads/master from [~teaandcoffee] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=e4ba48a ] ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631070#comment-16631070 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user asfgit closed the pull request at: https://github.com/apache/activemq-artemis/pull/2187 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631078#comment-16631078 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221086337 --- Diff: artemis-core-client/src/main/resources/activemq-version.properties --- @@ -20,4 +20,4 @@ activemq.version.minorVersion=${activemq.version.minorVersion} activemq.version.microVersion=${activemq.version.microVersion} activemq.version.incrementingVersion=${activemq.version.incrementingVersion} activemq.version.versionTag=${activemq.version.versionTag} -activemq.version.compatibleVersionList=121,122,123,124,125,126,127,128,129 --- End diff -- sorry for me being inconsistent here... cherry-pick into 2.6.x was a piece of cake. no issues. this is a fix anyway... so.. it will be ok as long as the artemis-version.properties is in sync with 2.7.0 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631080#comment-16631080 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit f4734868a5a07dfc6db533a96f9f8e01de5139c5 in activemq-artemis's branch refs/heads/2.6.x from [~jbertram] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=f473486 ] ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. (cherry picked from commit a28b4fb34eb3cc178dd611d0cb2acc51d6b7a965) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631079#comment-16631079 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit c9d8697a6cf5e4620970da878fc5ab4f8d9d148f in activemq-artemis's branch refs/heads/2.6.x from [~teaandcoffee] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=c9d8697 ] ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions (cherry picked from commit e4ba48a31193ac532404d93b37f29d2720f1a863) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631081#comment-16631081 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit f4734868a5a07dfc6db533a96f9f8e01de5139c5 in activemq-artemis's branch refs/heads/2.6.x from [~jbertram] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=f473486 ] ARTEMIS-1545 refactor & rework a few incompatible pieces Existing commit for ARTEMIS-1545 broke bridges and large messages. This commit fixes those, and refactors the solution a bit to be more clear. (cherry picked from commit a28b4fb34eb3cc178dd611d0cb2acc51d6b7a965) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631339#comment-16631339 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221139457 --- Diff: artemis-core-client/src/main/resources/activemq-version.properties --- @@ -20,4 +20,4 @@ activemq.version.minorVersion=${activemq.version.minorVersion} activemq.version.microVersion=${activemq.version.microVersion} activemq.version.incrementingVersion=${activemq.version.incrementingVersion} activemq.version.versionTag=${activemq.version.versionTag} -activemq.version.compatibleVersionList=121,122,123,124,125,126,127,128,129 --- End diff -- Whats 2.7 timeline > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631604#comment-16631604 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user gemmellr commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221191158 --- Diff: artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java --- @@ -577,26 +587,62 @@ private CompletionListenerWrapper(CompletionListener listener, @Override public void sendAcknowledged(org.apache.activemq.artemis.api.core.Message clientMessage) { - if (jmsMessage instanceof StreamMessage) { -try { - ((StreamMessage) jmsMessage).reset(); -} catch (JMSException e) { - // HORNETQ-1209 XXX ignore? + if (active.get()) { --- End diff -- Doing a getAndSet seems like it might be nicer given the aim to ensure only a single processing and call on the CompletionListener occurs. Granted though its not likely that multiple concurrent attempts are going to be made here. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631603#comment-16631603 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user gemmellr commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221189768 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/SendAcknowledgementHandler.java --- @@ -41,4 +41,13 @@ * @param message message sent asynchronously */ void sendAcknowledged(Message message); + + default void sendFailed(Message message, Exception e) { + /** + * By default ignore failures to preserve compatibility with existing implementations. + * If the message makes it to the broker and a failure occurs sendAcknowledge() will --- End diff -- Is this actually true? From skimming the diff it seems like it may not be as there are some if-else sections added that call one of the handler methods only. Unless somewhere else is also calling the sendAcknowledged method (possibly in duplicate?) then it seems if only the failure method gets called, and this default method drops it, that would mean an existing listener that doesn't implement sendFailed then wont see anything at all now. IF that is the case it suggests some tests are missing. Should this default method impl perhaps be calling sendAcknowledged()? (uglier alternative, the calling code could check the sendFailed method is actually implemented and decide which to call) > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed t
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631823#comment-16631823 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 2242d2447cdaaf3f7ad59f1b9c342035e9b8426e in activemq-artemis's branch refs/heads/2.6.x from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=2242d24 ] Reverting JMS Completion listener on 2.6.x.. This change is too big for maintainance branch. Reverting it. Revert "ARTEMIS-1545 refactor & rework a few incompatible pieces" Revert "ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions" This reverts commit c9d8697a6cf5e4620970da878fc5ab4f8d9d148f. This reverts commit f4734868a5a07dfc6db533a96f9f8e01de5139c5. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631822#comment-16631822 ] ASF subversion and git services commented on ARTEMIS-1545: -- Commit 2242d2447cdaaf3f7ad59f1b9c342035e9b8426e in activemq-artemis's branch refs/heads/2.6.x from Clebert Suconic [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=2242d24 ] Reverting JMS Completion listener on 2.6.x.. This change is too big for maintainance branch. Reverting it. Revert "ARTEMIS-1545 refactor & rework a few incompatible pieces" Revert "ARTEMIS-1545 Support JMS 2.0 Completion Listener for Exceptions" This reverts commit c9d8697a6cf5e4620970da878fc5ab4f8d9d148f. This reverts commit f4734868a5a07dfc6db533a96f9f8e01de5139c5. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16632016#comment-16632016 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r221293865 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/SendAcknowledgementHandler.java --- @@ -41,4 +41,13 @@ * @param message message sent asynchronously */ void sendAcknowledged(Message message); + + default void sendFailed(Message message, Exception e) { + /** + * By default ignore failures to preserve compatibility with existing implementations. + * If the message makes it to the broker and a failure occurs sendAcknowledge() will --- End diff -- Ill let @jbertram comment here in original version it was done but for reason justin changed it. Im sure for good reason > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Reporter: Michael Andre Pearce >Priority: Major > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637064#comment-16637064 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r222350527 --- Diff: artemis-core-client/src/main/resources/activemq-version.properties --- @@ -20,4 +20,4 @@ activemq.version.minorVersion=${activemq.version.minorVersion} activemq.version.microVersion=${activemq.version.microVersion} activemq.version.incrementingVersion=${activemq.version.incrementingVersion} activemq.version.versionTag=${activemq.version.versionTag} -activemq.version.compatibleVersionList=121,122,123,124,125,126,127,128,129 --- End diff -- @michaelandrepearce I would say end of the year.. i wanted to fix large messages in AMQP first that doesn't prevent you from cherry-picking the fix on another branch. I know you use Red Hat's downstream version.. this could be cherry-picked. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Affects Versions: 2.6.3 >Reporter: Michael Andre Pearce >Priority: Major > Fix For: 2.7.0 > > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637083#comment-16637083 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user jbertram commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r222356400 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/SendAcknowledgementHandler.java --- @@ -41,4 +41,13 @@ * @param message message sent asynchronously */ void sendAcknowledged(Message message); + + default void sendFailed(Message message, Exception e) { + /** + * By default ignore failures to preserve compatibility with existing implementations. + * If the message makes it to the broker and a failure occurs sendAcknowledge() will --- End diff -- @gemmellr, at this point I'd say work up a test and send a PR. IMO, there's not much use discussing this on a PR that's already been merged. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Affects Versions: 2.6.3 >Reporter: Michael Andre Pearce >Priority: Major > Fix For: 2.7.0 > > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637086#comment-16637086 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user gemmellr commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2187#discussion_r222357714 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/SendAcknowledgementHandler.java --- @@ -41,4 +41,13 @@ * @param message message sent asynchronously */ void sendAcknowledged(Message message); + + default void sendFailed(Message message, Exception e) { + /** + * By default ignore failures to preserve compatibility with existing implementations. + * If the message makes it to the broker and a failure occurs sendAcknowledge() will --- End diff -- I'm not going digging with tests, I just thought I'd point out the apparently incorrect comment added, and seeming change of behaviour to what it comments on. If you can't see an issue thats fine. > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Affects Versions: 2.6.3 >Reporter: Michael Andre Pearce >Priority: Major > Fix For: 2.7.0 > > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16662490#comment-16662490 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce closed the pull request at: https://github.com/apache/activemq-artemis/pull/1733 > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Affects Versions: 2.6.3 >Reporter: Michael Andre Pearce >Priority: Major > Fix For: 2.7.0 > > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-1545) JMS MessageProducer fails to expose exception on send when message is sent non-persistent, but not authorised
[ https://issues.apache.org/jira/browse/ARTEMIS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16662492#comment-16662492 ] ASF GitHub Bot commented on ARTEMIS-1545: - Github user michaelandrepearce commented on the issue: https://github.com/apache/activemq-artemis/pull/1733 Closing as merged by another PR > JMS MessageProducer fails to expose exception on send when message is sent > non-persistent, but not authorised > - > > Key: ARTEMIS-1545 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1545 > Project: ActiveMQ Artemis > Issue Type: Bug >Affects Versions: 2.6.3 >Reporter: Michael Andre Pearce >Priority: Major > Fix For: 2.7.0 > > > When sending persistent, behaviour is blocking and a Security exception is > thrown. The same behaviour that the client is exposed to the client when > sending non-persistent, so that a client could log or take action > asynchronously. > This can be recreated easily by the following: > Add the following security section , that means guest is not auth'd to send > to "guest.cannot.send" > activemq-artemis/tests/jms-tests/src/test/resources/broker.xml > > > > > > > > > > Then add the following tests to this test (first is proving exception > correctly is thrown when persistent is sent using jms api, and second shows > behaviour difference and no error): > activemq-artemis/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java > /** > * Login with valid user and password > * But try send to address not authorised - Persistent > * Should not allow and should throw exception > */ >@Test >public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} >/** > * Login with valid user and password > * But try send to address not authorised - Non Persistent. > * Should have same behaviour as Persistent with exception on send. > */ >@Test >public void > testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws > Exception { > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616"); > Connection connection = connectionFactory.createConnection("guest", > "guest"); > Session session = connection.createSession(); > Destination destination = session.createQueue("guest.cannot.send"); > MessageProducer messageProducer = session.createProducer(destination); > messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > try { > messageProducer.send(session.createTextMessage("hello")); > fail("JMSSecurityException expected as guest is not allowed to > send"); > } catch (JMSSecurityException activeMQSecurityException){ > //pass > } > connection.close(); >} -- This message was sent by Atlassian JIRA (v7.6.3#76005)