Write correct arraySize for real arrays. bug23710
authorSteve Powell <steve@rabbitmq.com>
Thu Feb 02 11:39:32 2012 +0000 (3 months ago)
branchbug23710
changeset 1905fd7e7eed57d3
parent 1904 2a6d1c2e48a5
child 1906 b7f61b9bbaf5
Write correct arraySize for real arrays.
src/com/rabbitmq/client/impl/ValueWriter.java
test/src/com/rabbitmq/client/test/functional/QueueLifecycle.java
     1.1 --- a/src/com/rabbitmq/client/impl/ValueWriter.java	Wed Feb 01 17:33:38 2012 +0000
     1.2 +++ b/src/com/rabbitmq/client/impl/ValueWriter.java	Thu Feb 02 11:39:32 2012 +0000
     1.3 @@ -231,7 +231,7 @@
     1.4              out.write(0);
     1.5          }
     1.6          else {
     1.7 -            out.writeInt(value.length);
     1.8 +            out.writeInt((int)Frame.arraySize(value));
     1.9              for (Object item : value) {
    1.10                  writeFieldValue(item);
    1.11              }
     2.1 --- a/test/src/com/rabbitmq/client/test/functional/QueueLifecycle.java	Wed Feb 01 17:33:38 2012 +0000
     2.2 +++ b/test/src/com/rabbitmq/client/test/functional/QueueLifecycle.java	Thu Feb 02 11:39:32 2012 +0000
     2.3 @@ -158,13 +158,13 @@
     2.4          verifyQueueMissing(name);
     2.5      }
     2.6  
     2.7 -    public void testArgumentArrays() throws Exception {
     2.8 +    public void testArgumentArrays() throws IOException {
     2.9          Map<String, Object> args = new HashMap<String, Object>();
    2.10 -        args.put("my-key", new String[]{"foo", "bar", "baz"});
    2.11 +        String[] arr = new String[]{"foo", "bar", "baz"};
    2.12 +        args.put("my-key", arr);
    2.13 +//        args.put("my-key", Arrays.asList(arr));
    2.14          String queueName = "argumentArraysQueue";
    2.15          channel.queueDeclare(queueName, true, true, false, args).getQueue();
    2.16 -        args = new HashMap<String, Object>();
    2.17 -        args.put("my-key", Arrays.asList(new String[]{"foo", "bar", "baz"}));
    2.18          verifyQueueExists(queueName);
    2.19      }
    2.20  }