Skip to content

Commit 809fe3c

Browse files
author
Steve Powell
committed
Write correct arraySize for real arrays.
1 parent f05f233 commit 809fe3c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/com/rabbitmq/client/impl/ValueWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public final void writeArray(Object[] value)
231231
out.write(0);
232232
}
233233
else {
234-
out.writeInt(value.length);
234+
out.writeInt((int)Frame.arraySize(value));
235235
for (Object item : value) {
236236
writeFieldValue(item);
237237
}

test/src/com/rabbitmq/client/test/functional/QueueLifecycle.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ public void testExclusiveGoesWithConnection() throws IOException {
158158
verifyQueueMissing(name);
159159
}
160160

161-
public void testArgumentArrays() throws Exception {
161+
public void testArgumentArrays() throws IOException {
162162
Map<String, Object> args = new HashMap<String, Object>();
163-
args.put("my-key", new String[]{"foo", "bar", "baz"});
163+
String[] arr = new String[]{"foo", "bar", "baz"};
164+
args.put("my-key", arr);
165+
// args.put("my-key", Arrays.asList(arr));
164166
String queueName = "argumentArraysQueue";
165167
channel.queueDeclare(queueName, true, true, false, args).getQueue();
166-
args = new HashMap<String, Object>();
167-
args.put("my-key", Arrays.asList(new String[]{"foo", "bar", "baz"}));
168168
verifyQueueExists(queueName);
169169
}
170170
}

0 commit comments

Comments
 (0)