Polishing
This commit is contained in:
parent
b5bd977d9a
commit
d00e1c5e4f
|
|
@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -69,8 +70,7 @@ public abstract class JmxUtils {
|
|||
* {@code MBeanServer} can be found. Logs a warning if more than one
|
||||
* {@code MBeanServer} found, returning the first one from the list.
|
||||
* @return the {@code MBeanServer} if found
|
||||
* @throws org.springframework.jmx.MBeanServerNotFoundException
|
||||
* if no {@code MBeanServer} could be found
|
||||
* @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
|
||||
* @see javax.management.MBeanServerFactory#findMBeanServer
|
||||
*/
|
||||
public static MBeanServer locateMBeanServer() throws MBeanServerNotFoundException {
|
||||
|
|
@ -85,8 +85,7 @@ public abstract class JmxUtils {
|
|||
* If this parameter is {@code null}, all registered MBeanServers are considered.
|
||||
* If the empty String is given, the platform MBeanServer will be returned.
|
||||
* @return the {@code MBeanServer} if found
|
||||
* @throws org.springframework.jmx.MBeanServerNotFoundException
|
||||
* if no {@code MBeanServer} could be found
|
||||
* @throws MBeanServerNotFoundException if no {@code MBeanServer} could be found
|
||||
* @see javax.management.MBeanServerFactory#findMBeanServer(String)
|
||||
*/
|
||||
public static MBeanServer locateMBeanServer(@Nullable String agentId) throws MBeanServerNotFoundException {
|
||||
|
|
@ -95,7 +94,7 @@ public abstract class JmxUtils {
|
|||
// null means any registered server, but "" specifically means the platform server
|
||||
if (!"".equals(agentId)) {
|
||||
List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId);
|
||||
if (servers != null && !servers.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(servers)) {
|
||||
// Check to see if an MBeanServer is registered.
|
||||
if (servers.size() > 1 && logger.isWarnEnabled()) {
|
||||
logger.warn("Found more than one MBeanServer instance" +
|
||||
|
|
|
|||
|
|
@ -535,9 +535,10 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|||
}
|
||||
|
||||
private void assertValidators(Validator... validators) {
|
||||
Object target = getTarget();
|
||||
for (Validator validator : validators) {
|
||||
if (validator != null && (getTarget() != null && !validator.supports(getTarget().getClass()))) {
|
||||
throw new IllegalStateException("Invalid target for Validator [" + validator + "]: " + getTarget());
|
||||
if (validator != null && (target != null && !validator.supports(target.getClass()))) {
|
||||
throw new IllegalStateException("Invalid target for Validator [" + validator + "]: " + target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import org.springframework.http.HttpStatus;
|
|||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.concurrent.SettableListenableFuture;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
|
|
@ -276,7 +277,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport {
|
|||
try {
|
||||
ClientRequest request = new ClientRequest().setMethod(method).setPath(url.getPath());
|
||||
request.getRequestHeaders().add(HttpString.tryFromString(HttpHeaders.HOST), url.getHost());
|
||||
if (body != null && !body.isEmpty()) {
|
||||
if (StringUtils.hasLength(body)) {
|
||||
HttpString headerName = HttpString.tryFromString(HttpHeaders.CONTENT_LENGTH);
|
||||
request.getRequestHeaders().add(headerName, body.length());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue