diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:29:37 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:29:37 +0000 |
commit | 57b377b5cf335e839aaac5d559f7c761fd18f339 (patch) | |
tree | 5b25dfbfa20efb7f6513f7b858382b754718166f | |
parent | f4fb1da85c3ed2c4af60588325e7856f98e6ecd7 (diff) | |
download | qpid-python-57b377b5cf335e839aaac5d559f7c761fd18f339.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).
merged from trunk r763959
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5-fix@764490 13f79535-47bb-0310-9956-ffa450edef68
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 eb4c3313d3..e1e93ae9cb 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 @@ -106,7 +106,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() |