Skip to content

Commit 12357fd

Browse files
committed
Add byte[] to supported JMS message header types
Closes gh-28421
1 parent f8c4071 commit 12357fd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

spring-jms/src/main/java/org/springframework/jms/support/SimpleJmsHeaderMapper.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,10 +16,8 @@
1616

1717
package org.springframework.jms.support;
1818

19-
import java.util.Arrays;
2019
import java.util.Enumeration;
2120
import java.util.HashMap;
22-
import java.util.HashSet;
2321
import java.util.Map;
2422
import java.util.Set;
2523

@@ -56,8 +54,8 @@
5654
*/
5755
public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> implements JmsHeaderMapper {
5856

59-
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = new HashSet<>(Arrays.asList(
60-
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class));
57+
private static final Set<Class<?>> SUPPORTED_PROPERTY_TYPES = Set.of(Boolean.class, Byte.class,
58+
Double.class, Float.class, Integer.class, Long.class, Short.class, String.class, byte[].class);
6159

6260

6361
@Override
@@ -99,7 +97,7 @@ public void fromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage)
9997
Object value = entry.getValue();
10098
if (value != null && SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) {
10199
try {
102-
String propertyName = this.fromHeaderName(headerName);
100+
String propertyName = fromHeaderName(headerName);
103101
jmsMessage.setObjectProperty(propertyName, value);
104102
}
105103
catch (Exception ex) {
@@ -211,7 +209,7 @@ public MessageHeaders toHeaders(jakarta.jms.Message jmsMessage) {
211209
while (jmsPropertyNames.hasMoreElements()) {
212210
String propertyName = jmsPropertyNames.nextElement().toString();
213211
try {
214-
String headerName = this.toHeaderName(propertyName);
212+
String headerName = toHeaderName(propertyName);
215213
headers.put(headerName, jmsMessage.getObjectProperty(propertyName));
216214
}
217215
catch (Exception ex) {

0 commit comments

Comments
 (0)