Merge pull request #39389 from onobc
* pr/39389: Remove use of Pulsar ObjectMapperFactory Closes gh-39389
This commit is contained in:
		
						commit
						36d850db0c
					
				| 
						 | 
				
			
			@ -23,6 +23,7 @@ import java.util.TreeMap;
 | 
			
		|||
import java.util.concurrent.TimeUnit;
 | 
			
		||||
import java.util.function.BiConsumer;
 | 
			
		||||
import java.util.function.Consumer;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import org.apache.pulsar.client.admin.PulsarAdminBuilder;
 | 
			
		||||
import org.apache.pulsar.client.api.ClientBuilder;
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +31,6 @@ import org.apache.pulsar.client.api.ConsumerBuilder;
 | 
			
		|||
import org.apache.pulsar.client.api.ProducerBuilder;
 | 
			
		||||
import org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException;
 | 
			
		||||
import org.apache.pulsar.client.api.ReaderBuilder;
 | 
			
		||||
import org.apache.pulsar.common.util.ObjectMapperFactory;
 | 
			
		||||
 | 
			
		||||
import org.springframework.boot.context.properties.PropertyMapper;
 | 
			
		||||
import org.springframework.pulsar.listener.PulsarContainerProperties;
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,10 @@ final class PulsarPropertiesMapper {
 | 
			
		|||
	private String getAuthenticationParamsJson(Map<String, String> params) {
 | 
			
		||||
		Map<String, String> sortedParams = new TreeMap<>(params);
 | 
			
		||||
		try {
 | 
			
		||||
			return ObjectMapperFactory.create().writeValueAsString(sortedParams);
 | 
			
		||||
			return sortedParams.entrySet()
 | 
			
		||||
				.stream()
 | 
			
		||||
				.map((e) -> "\"%s\":\"%s\"".formatted(e.getKey(), e.getValue()))
 | 
			
		||||
				.collect(Collectors.joining(",", "{", "}"));
 | 
			
		||||
		}
 | 
			
		||||
		catch (Exception ex) {
 | 
			
		||||
			throw new IllegalStateException("Could not convert auth parameters to encoded string", ex);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue