ARTEMIS-1102 Fixing Openwire test after security change

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2968e0a7
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2968e0a7
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2968e0a7

Branch: refs/heads/master
Commit: 2968e0a7dac85ad08fe34552e274f329e695fd94
Parents: 174b238
Author: Clebert Suconic <[email protected]>
Authored: Wed May 3 10:06:45 2017 -0400
Committer: Clebert Suconic <[email protected]>
Committed: Wed May 3 10:06:45 2017 -0400

----------------------------------------------------------------------
 .../core/protocol/openwire/OpenWireProtocolManager.java   | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2968e0a7/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
----------------------------------------------------------------------
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
index 61eeb1c..09c6509 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
@@ -34,6 +34,7 @@ import io.netty.channel.ChannelPipeline;
 import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
 import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
 import org.apache.activemq.artemis.api.core.BaseInterceptor;
 import org.apache.activemq.artemis.api.core.Interceptor;
 import org.apache.activemq.artemis.api.core.RoutingType;
@@ -289,7 +290,14 @@ public class OpenWireProtocolManager implements 
ProtocolManager<Interceptor>, Cl
       String username = info.getUserName();
       String password = info.getPassword();
 
-      validateUser(username, password, connection);
+      try {
+         validateUser(username, password, connection);
+      } catch (ActiveMQSecurityException e) {
+         // We need to send an exception used by the openwire
+         SecurityException ex = new SecurityException("User name [" + username 
+ "] or password is invalid.");
+         ex.initCause(e);
+         throw ex;
+      }
 
       String clientId = info.getClientId();
       if (clientId == null) {

Reply via email to