diff options
| author | Marnie McCormack <marnie@apache.org> | 2009-04-10 15:14:29 +0000 |
|---|---|---|
| committer | Marnie McCormack <marnie@apache.org> | 2009-04-10 15:14:29 +0000 |
| commit | c2f9da7dc06892f89b5b6fd7f1725c609a5e759a (patch) | |
| tree | 8ef11bd33eccbafec18581f9b5086c9cc5d5be12 /qpid/java | |
| parent | 536cd3c214796b586abd94c791a4c82e74311845 (diff) | |
| download | qpid-python-c2f9da7dc06892f89b5b6fd7f1725c609a5e759a.tar.gz | |
QPID-1801 Added method to show failure to PrincipalPermissionsTest.java and then adjusted the ternary operator in PrincipalPermissions.java to ensure we don't pass a null into the map (see JIRA descriptions).
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@763959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
2 files changed, 11 insertions, 2 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java index 35b76bcf32..f852514444 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/PrincipalPermissions.java @@ -157,7 +157,7 @@ public class PrincipalPermissions AMQShortString queueName = parameters.length > 1 ? (AMQShortString) parameters[1] : null; AMQShortString exchangeName = parameters.length > 2 ? (AMQShortString) parameters[2] : null; //Set the routingkey to the specified value or the queueName if present - AMQShortString routingKey = parameters.length > 3 ? (AMQShortString) parameters[3] : queueName; + AMQShortString routingKey = (parameters.length > 3 && null != parameters[3]) ? (AMQShortString) parameters[3] : queueName; // Get the queues map Map create_queues = (Map) createRights.get(CREATE_QUEUES_KEY); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java index 56a3783126..1ff3e5a880 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/access/PrincipalPermissionsTest.java @@ -107,7 +107,16 @@ public class PrincipalPermissionsTest extends TestCase _perms.grant(Permission.CREATEQUEUE, grantArgs); assertEquals(AuthzResult.ALLOWED, _perms.authorise(Permission.CREATEQUEUE, authArgs)); } - + + public void testQueueCreateWithNullRoutingKey() + { + Object[] grantArgs = new Object[]{_temporary , _queueName, _exchangeName, null}; + Object[] authArgs = new Object[]{_autoDelete, _queueName}; + + assertEquals(AuthzResult.DENIED, _perms.authorise(Permission.CREATEQUEUE, authArgs)); + _perms.grant(Permission.CREATEQUEUE, grantArgs); + assertEquals(AuthzResult.ALLOWED, _perms.authorise(Permission.CREATEQUEUE, authArgs)); + } // FIXME disabled, this fails due to grant putting the grant into the wrong map QPID-1598 public void disableTestExchangeCreate() |
