You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2016/08/24 10:55:16 UTC
svn commit: r1757491 -
/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
Author: lquack
Date: Wed Aug 24 10:55:16 2016
New Revision: 1757491
URL: http://svn.apache.org/viewvc?rev=1757491&view=rev
Log:
QPID-7346: [Java Broker] Fix backward compatibility of Queue.exclusiveOwner
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1757491&r1=1757490&r2=1757491&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java Wed Aug 24 10:55:16 2016
@@ -33,6 +33,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
@@ -403,7 +404,15 @@ public abstract class AbstractQueue<X ex
String owner = MapValueConverter.getStringAttribute(Queue.OWNER, attributes, null);
if(owner != null)
{
- Principal ownerPrincipal = new GenericPrincipal(owner);
+ Principal ownerPrincipal;
+ try
+ {
+ ownerPrincipal = new GenericPrincipal(owner);
+ }
+ catch (IllegalArgumentException e)
+ {
+ ownerPrincipal = new GenericPrincipal(owner + "@('')");
+ }
_exclusiveOwner = new AuthenticatedPrincipal(ownerPrincipal);
}
}
@@ -798,13 +807,14 @@ public abstract class AbstractQueue<X ex
}
break;
case PRINCIPAL:
+ Principal currentAuthorizedPrincipal = target.getSessionModel().getAMQPConnection().getAuthorizedPrincipal();
if(exclusiveOwner == null)
{
- exclusiveOwner = target.getSessionModel().getAMQPConnection().getAuthorizedPrincipal();
+ exclusiveOwner = currentAuthorizedPrincipal;
}
else
{
- if(!exclusiveOwner.equals(target.getSessionModel().getAMQPConnection().getAuthorizedPrincipal()))
+ if(!Objects.equals(((Principal) exclusiveOwner).getName(), currentAuthorizedPrincipal.getName()))
{
throw new ConsumerAccessRefused();
}
@@ -2953,7 +2963,8 @@ public abstract class AbstractQueue<X ex
allowed = _exclusiveOwner == null || _exclusiveOwner == session.getAMQPConnection();
break;
case PRINCIPAL:
- allowed = _exclusiveOwner == null || _exclusiveOwner.equals(session.getAMQPConnection().getAuthorizedPrincipal());
+ allowed = _exclusiveOwner == null || Objects.equals(((Principal) _exclusiveOwner).getName(),
+ session.getAMQPConnection().getAuthorizedPrincipal().getName());
break;
case CONTAINER:
allowed = _exclusiveOwner == null || _exclusiveOwner.equals(session.getAMQPConnection().getRemoteContainerName());
@@ -3119,7 +3130,8 @@ public abstract class AbstractQueue<X ex
{
principal = c.getSessionModel().getAMQPConnection().getAuthorizedPrincipal();
}
- else if(!principal.equals(c.getSessionModel().getAMQPConnection().getAuthorizedPrincipal()))
+ else if(!Objects.equals(principal.getName(),
+ c.getSessionModel().getAMQPConnection().getAuthorizedPrincipal().getName()))
{
throw new ExistingConsumerPreventsExclusive();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org