Skip to content

Commit

Permalink
Move off incompatible Base64Utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaMaciaszek committed Aug 7, 2024
1 parent 4f304bf commit e3804f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -98,7 +97,7 @@ public void getEvents() {
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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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<String, Object> getProperties() {
Expand Down

0 comments on commit e3804f2

Please sign in to comment.