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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -16,10 +16,8 @@
|
|||
|
||||
package org.springframework.jms.support;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -56,8 +54,8 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> implements JmsHeaderMapper {
|
||||
|
||||
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = new HashSet<>(Arrays.asList(
|
||||
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class));
|
||||
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = Set.of(Boolean.class, Byte.class,
|
||||
Double.class, Float.class, Integer.class, Long.class, Short.class, String.class, byte[].class);
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -99,7 +97,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
|
|||
Object value = entry.getValue();
|
||||
if (value != null && SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) {
|
||||
try {
|
||||
String propertyName = this.fromHeaderName(headerName);
|
||||
String propertyName = fromHeaderName(headerName);
|
||||
jmsMessage.setObjectProperty(propertyName, value);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
@ -211,7 +209,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
|
|||
while (jmsPropertyNames.hasMoreElements()) {
|
||||
String propertyName = jmsPropertyNames.nextElement().toString();
|
||||
try {
|
||||
String headerName = this.toHeaderName(propertyName);
|
||||
String headerName = toHeaderName(propertyName);
|
||||
headers.put(headerName, jmsMessage.getObjectProperty(propertyName));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue