in shims/qpid-jms/src/main/java/org/apache/qpid/interop_test/jms_messages_test/Sender.java [218:270]
protected MapMessage createJMSMapMessage(String testValueType, String testValue, int testValueNum) throws Exception, JMSException {
MapMessage message = _session.createMapMessage();
String name = String.format("%s%03d", testValueType, testValueNum);
switch (testValueType) {
case "boolean":
message.setBoolean(name, Boolean.parseBoolean(testValue));
break;
case "byte":
message.setByte(name, Byte.decode(testValue));
break;
case "bytes":
message.setBytes(name, Base64.getDecoder().decode(testValue));
break;
case "char":
byte[] decodedValue = Base64.getDecoder().decode(testValue);
if (decodedValue.length == 1) { // Char format: "X" or "\xNN"
message.setChar(name, (char)decodedValue[0]);
} else if (decodedValue.length == 6) { // Char format: "\xNNNN"
message.setChar(name, ByteBuffer.wrap(decodedValue).getChar());
} else {
throw new Exception("JmsSenderShim.createJMSMapMessage() Malformed char string: \"" + decodedValue + "\"");
}
break;
case "double":
Long l1 = Long.parseLong(testValue.substring(2, 3), 16) << 60;
Long l2 = Long.parseLong(testValue.substring(3), 16);
message.setDouble(name, Double.longBitsToDouble(l1 | l2));
break;
case "float":
Long i = Long.parseLong(testValue.substring(2), 16);
message.setFloat(name, Float.intBitsToFloat(i.intValue()));
break;
case "int":
message.setInt(name, Integer.decode(testValue));
break;
case "long":
message.setLong(name, Long.decode(testValue));
break;
case "object":
Object obj = (Object)createObject(testValue);
message.setObject(name, obj);
break;
case "short":
message.setShort(name, Short.decode(testValue));
break;
case "string":
message.setString(name, testValue);
break;
default:
throw new Exception("Internal exception: Unexpected JMS message sub-type \"" + testValueType + "\"");
}
return message;
}