Skip to content

Commit 8c11112

Browse files
author
Emile Joubert
committed
Merged bug24988 into default
2 parents 70ea568 + f9de107 commit 8c11112

File tree

2 files changed

+20
-33
lines changed

2 files changed

+20
-33
lines changed

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

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
import com.rabbitmq.utility.BlockingCell;
4545
import com.rabbitmq.utility.Utility;
4646

47+
final class Copyright {
48+
final static String COPYRIGHT="Copyright (C) 2007-2012 VMware, Inc.";
49+
final static String LICENSE="Licensed under the MPL. See http://www.rabbitmq.com/";
50+
}
51+
4752
/**
4853
* Concrete class representing and managing an AMQP connection to a broker.
4954
* <p>
@@ -63,21 +68,22 @@ public class AMQConnection extends ShutdownNotifierComponent implements Connecti
6368
* @see Connection#getClientProperties
6469
*/
6570
public static final Map<String, Object> defaultClientProperties() {
71+
Map<String,Object> props = new HashMap<String, Object>();
72+
props.put("product", LongStringHelper.asLongString("RabbitMQ"));
73+
props.put("version", LongStringHelper.asLongString(ClientVersion.VERSION));
74+
props.put("platform", LongStringHelper.asLongString("Java"));
75+
props.put("copyright", LongStringHelper.asLongString(Copyright.COPYRIGHT));
76+
props.put("information", LongStringHelper.asLongString(Copyright.LICENSE));
77+
6678
Map<String, Object> capabilities = new HashMap<String, Object>();
6779
capabilities.put("publisher_confirms", true);
6880
capabilities.put("exchange_exchange_bindings", true);
6981
capabilities.put("basic.nack", true);
7082
capabilities.put("consumer_cancel_notify", true);
71-
return buildTable(new Object[] {
72-
"product", LongStringHelper.asLongString("RabbitMQ"),
73-
"version", LongStringHelper.asLongString(ClientVersion.VERSION),
74-
"platform", LongStringHelper.asLongString("Java"),
75-
"copyright", LongStringHelper.asLongString(
76-
"Copyright (C) 2007-2012 VMware, Inc."),
77-
"information", LongStringHelper.asLongString(
78-
"Licensed under the MPL. See http://www.rabbitmq.com/"),
79-
"capabilities", capabilities
80-
});
83+
84+
props.put("capabilities", capabilities);
85+
86+
return props;
8187
}
8288

8389
private static final Version clientVersion =
@@ -799,20 +805,4 @@ public void close(int closeCode,
799805
private String getHostAddress() {
800806
return getAddress() == null ? null : getAddress().getHostAddress();
801807
}
802-
803-
/**
804-
* Utility for constructing a java.util.Map instance from an
805-
* even-length array containing alternating String keys (on the
806-
* even elements, starting at zero) and values (on the odd
807-
* elements, starting at one).
808-
*/
809-
private static final Map<String, Object> buildTable(Object[] keysValues) {
810-
Map<String, Object> result = new HashMap<String, Object>();
811-
for (int index = 0; index < keysValues.length; index += 2) {
812-
String key = (String) keysValues[index];
813-
Object value = keysValues[index + 1];
814-
result.put(key, value);
815-
}
816-
return result;
817-
}
818808
}

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ public Frame confuse(Frame frame) {
9696
if (frame.type == AMQP.FRAME_METHOD) {
9797
// We can't just skip the method as that will lead us to
9898
// send 0 bytes and hang waiting for a response.
99-
Frame confusedFrame = new Frame(AMQP.FRAME_HEADER,
100-
frame.channel,
101-
frame.getPayload());
102-
return confusedFrame;
99+
return new Frame(AMQP.FRAME_HEADER,
100+
frame.channel, frame.getPayload());
103101
}
104102
return frame;
105103
}
@@ -119,12 +117,11 @@ public Frame confuse(Frame frame) {
119117

120118
public void testWrongClassInHeader() throws IOException {
121119
expectUnexpectedFrameError(new Confuser() {
122-
public Frame confuse(Frame frame) throws IOException {
120+
public Frame confuse(Frame frame) {
123121
if (frame.type == AMQP.FRAME_HEADER) {
124122
byte[] payload = frame.getPayload();
125123
Frame confusedFrame = new Frame(AMQP.FRAME_HEADER,
126-
frame.channel,
127-
payload);
124+
frame.channel, payload);
128125
// First two bytes = class ID, must match class ID from
129126
// method.
130127
payload[0] = 12;

0 commit comments

Comments
 (0)