From ee5ea036cc0db7969f24f6d7fd53ad823eb79ad9 Mon Sep 17 00:00:00 2001 From: abilan Date: Tue, 21 Feb 2023 13:47:15 -0500 Subject: [PATCH] Fix deprecations from upstream dependencies --- .../integration/sftp/session/SftpServerTests.java | 6 +++--- .../WebFluxRequestExecutingMessageHandlerTests.java | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java index 1d03c556b3..1134ec420d 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2023 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. @@ -28,6 +28,7 @@ import java.security.KeyFactory; import java.security.PublicKey; import java.security.spec.RSAPublicKeySpec; import java.util.Arrays; +import java.util.Base64; import java.util.Collections; import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory; @@ -40,7 +41,6 @@ import org.junit.jupiter.api.Test; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.integration.file.remote.session.Session; -import org.springframework.util.Base64Utils; import org.springframework.util.FileCopyUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -121,7 +121,7 @@ public class SftpServerTests { while (keyBytes[keyBytes.length - 1] == 0x0a || keyBytes[keyBytes.length - 1] == 0x0d) { keyBytes = Arrays.copyOf(keyBytes, keyBytes.length - 1); } - byte[] decodeBuffer = Base64Utils.decode(keyBytes); + byte[] decodeBuffer = Base64.getDecoder().decode(keyBytes); ByteBuffer bb = ByteBuffer.wrap(decodeBuffer); int len = bb.getInt(); byte[] type = new byte[len]; diff --git a/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java b/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java index bfa1a8a588..93aded3ba4 100644 --- a/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java +++ b/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2023 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,6 +16,7 @@ package org.springframework.integration.webflux.outbound; +import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; @@ -282,9 +283,7 @@ class WebFluxRequestExecutingMessageHandlerTests { assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN); - StepVerifier.create( - response.getBody() - .map(dataBuffer -> new String(dataBuffer.toByteBuffer().array()))) + StepVerifier.create(response.getBody().map(dataBuffer -> dataBuffer.toString(StandardCharsets.UTF_8))) .expectNext("foo", "bar", "baz") .verifyComplete(); }