Move off incompatible Base64Utils.

This commit is contained in:
Olga Maciaszek-Sharma
2024-08-07 18:21:07 +02:00
parent 4f304bfadb
commit e3804f2e6e
2 changed files with 6 additions and 7 deletions

View File

@@ -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.apache.commons.logging.LogFactory;
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 class ConsulInboundMessageProducer extends MessageProducerSupport {
for (Event event : events) {
// Map<String, Object> 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());

View File

@@ -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 @@ package org.springframework.cloud.consul.config;
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 org.springframework.util.StringUtils;
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 class ConsulPropertySource extends EnumerablePropertySource<ConsulClient>
if (value == null) {
return null;
}
return new String(decodeFromString(value));
return new String(Base64.getDecoder().decode(value));
}
protected Map<String, Object> getProperties() {