Ensure logPrefix is not null or blank in AbstractListenerWriteProcessor

This commit is contained in:
Sam Brannen 2020-03-31 18:49:05 +02:00
parent e87ab6f4ee
commit 89d282125a
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -27,6 +27,7 @@ import org.reactivestreams.Subscription;
import org.springframework.core.log.LogDelegateFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Abstract base class for {@code Processor} implementations that bridge between
@ -87,13 +88,13 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
* @since 5.1
*/
public AbstractListenerWriteProcessor(String logPrefix) {
this.logPrefix = logPrefix;
this.logPrefix = (StringUtils.hasText(logPrefix) ? logPrefix : "");
this.resultPublisher = new WriteResultPublisher(logPrefix);
}
/**
* Create an instance with the given log prefix.
* Get the configured log prefix.
* @since 5.1
*/
public String getLogPrefix() {