From e3804f2e6ed7266a482780063da2271481c72fde Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Wed, 7 Aug 2024 18:21:07 +0200 Subject: [PATCH] Move off incompatible Base64Utils. --- .../cloud/consul/binder/ConsulInboundMessageProducer.java | 7 +++---- .../cloud/consul/config/ConsulPropertySource.java | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/ConsulInboundMessageProducer.java b/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/ConsulInboundMessageProducer.java index 00b93b944..898211a15 100644 --- a/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/ConsulInboundMessageProducer.java +++ b/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/ConsulInboundMessageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2024 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.cloud.consul.binder; +import java.util.Base64; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -29,8 +30,6 @@ import org.springframework.integration.endpoint.MessageProducerSupport; -import static org.springframework.util.Base64Utils.decodeFromString; - /** * Adapter that receives Messages from Consul Events, converts them into Spring * Integration Messages, and sends the results to a Message Channel. @@ -98,7 +97,7 @@ public void getEvents() { for (Event event : events) { // Map headers = new HashMap<>(); // headers.put(MessageHeaders.REPLY_CHANNEL, outputChannel.) - String decoded = new String(decodeFromString(event.getPayload())); + String decoded = new String(Base64.getDecoder().decode(event.getPayload())); sendMessage(getMessageBuilderFactory().withPayload(decoded) // TODO: support headers .build()); diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java index 46de5008d..173658af7 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2024 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. @@ -19,6 +19,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.Charset; +import java.util.Base64; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -37,7 +38,6 @@ import static org.springframework.cloud.consul.config.ConsulConfigProperties.Format.PROPERTIES; import static org.springframework.cloud.consul.config.ConsulConfigProperties.Format.YAML; -import static org.springframework.util.Base64Utils.decodeFromString; /** * @author Spencer Gibb @@ -175,7 +175,7 @@ public String getDecoded(String value) { if (value == null) { return null; } - return new String(decodeFromString(value)); + return new String(Base64.getDecoder().decode(value)); } protected Map getProperties() {