Add byte[] to supported JMS message header types
Closes gh-28421
This commit is contained in:
parent
f8c4071f73
commit
12357fdf44
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -16,10 +16,8 @@
|
||||||
|
|
||||||
package org.springframework.jms.support;
|
package org.springframework.jms.support;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -56,8 +54,8 @@ import org.springframework.util.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> implements JmsHeaderMapper {
|
public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> implements JmsHeaderMapper {
|
||||||
|
|
||||||
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = new HashSet<>(Arrays.asList(
|
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = Set.of(Boolean.class, Byte.class,
|
||||||
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class));
|
Double.class, Float.class, Integer.class, Long.class, Short.class, String.class, byte[].class);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -99,7 +97,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
if (value != null && SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) {
|
if (value != null && SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) {
|
||||||
try {
|
try {
|
||||||
String propertyName = this.fromHeaderName(headerName);
|
String propertyName = fromHeaderName(headerName);
|
||||||
jmsMessage.setObjectProperty(propertyName, value);
|
jmsMessage.setObjectProperty(propertyName, value);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
|
@ -211,7 +209,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
|
||||||
while (jmsPropertyNames.hasMoreElements()) {
|
while (jmsPropertyNames.hasMoreElements()) {
|
||||||
String propertyName = jmsPropertyNames.nextElement().toString();
|
String propertyName = jmsPropertyNames.nextElement().toString();
|
||||||
try {
|
try {
|
||||||
String headerName = this.toHeaderName(propertyName);
|
String headerName = toHeaderName(propertyName);
|
||||||
headers.put(headerName, jmsMessage.getObjectProperty(propertyName));
|
headers.put(headerName, jmsMessage.getObjectProperty(propertyName));
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue