Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
### Key Bug Fixes
- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/))
- Fix bug of setting message headers repeatedly with different value types. ([#22939](https://github.com/Azure/azure-sdk-for-java/pull/22939))

### New Features
- Support configuration of `AmqpTransportType` for ServiceBusClientBuilder with property of `spring.cloud.azure.servicebus.transportType`, supported values are `AMQP` and `AMQP_WEB_SOCKETS`.

### Breaking Changes
- Encode message payload with UTF-8 charset instead of default charset of JVM when the payload is String. ([#23056](https://github.com/Azure/azure-sdk-for-java/pull/23056))

## 2.6.0 (2021-06-23)
### Breaking Changes
- Remove `azure-spring-cloud-telemetry` module dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
### Key Bug Fixes
- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/))

### Breaking Changes
- Encode message payload with UTF-8 charset instead of default charset of JVM when the payload is String. ([#23056](https://github.com/Azure/azure-sdk-for-java/pull/23056))

## 2.6.0 (2021-06-23)
### New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
### Key Bug Fixes
- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/))

### Breaking Changes
- Encode message payload with UTF-8 charset instead of default charset of JVM when the payload is String. ([#23056](https://github.com/Azure/azure-sdk-for-java/pull/23056))

## 2.6.0 (2021-06-23)
### Breaking Changes
Expand Down
3 changes: 3 additions & 0 deletions sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
### Key Bug Fixes
- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/))

### Breaking Changes
- Encode message payload with UTF-8 charset instead of default charset of JVM when the payload is String. ([#23056](https://github.com/Azure/azure-sdk-for-java/pull/23056))

## 2.6.0 (2021-06-23)
### New Features
- Upgrade to [spring-boot-dependencies:2.5.0](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.5.0/spring-boot-dependencies-2.5.0.pom).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.messaging.MessageHeaders;
import org.springframework.util.LinkedMultiValueMap;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -44,7 +44,7 @@ protected byte[] getPayload(EventData azureMessage) {

@Override
protected EventData fromString(String payload) {
return new EventData(payload.getBytes(Charset.defaultCharset()));
return new EventData(payload.getBytes(StandardCharsets.UTF_8));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import com.azure.spring.integration.core.converter.AzureMessageConverter;
import com.azure.spring.integration.test.support.UnaryAzureMessageConverterTest;
import org.junit.jupiter.api.Test;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.util.LinkedMultiValueMap;

import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
Expand All @@ -20,6 +22,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.messaging.support.NativeMessageHeaderAccessor.NATIVE_HEADERS;

Expand Down Expand Up @@ -47,6 +50,15 @@ protected void assertMessageHeadersEqual(EventData azureMessage, Message<?> mess
assertEquals(azureMessage.getProperties().get(headerProperties), message.getHeaders().get(headerProperties));
}

@Test
public void testNonUtf8DecodingPayload() {
String utf16Payload = new String(payload.getBytes(), StandardCharsets.UTF_16);
Message<String> message = MessageBuilder.withPayload(utf16Payload).build();
EventData azureMessage = getConverter().fromMessage(message, getTargetClass());
assertEquals(utf16Payload, azureMessage.getBodyAsString());
assertNotEquals(payload, azureMessage.getBodyAsString());
}

private static class MyEventHubMessageConverter extends EventHubMessageConverter {

public void setCustomHeaders(MessageHeaders headers, EventData azureMessage) {
Expand Down