Merge branch '5.2.x'

# Conflicts:
#	build.gradle
#	src/docs/asciidoc/core/core-aop-api.adoc
This commit is contained in:
Juergen Hoeller
2020-09-14 22:22:02 +02:00
9 changed files with 69 additions and 50 deletions

View File

@@ -103,6 +103,7 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
return this.defaultCharset;
}
@Override
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType) {
return (elementType.resolve() == String.class && super.canDecode(elementType, mimeType));
@@ -167,7 +168,6 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
/**
* Finds the first match and longest delimiter, {@link EndFrameBuffer} just after it.
*
* @param dataBuffer the buffer to find delimiters in
* @param matcher used to find the first delimiters
* @return a flux of buffers, containing {@link EndFrameBuffer} after each delimiter that was
@@ -221,7 +221,6 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
}
DataBuffer result = dataBuffers.get(0).factory().join(dataBuffers);
if (stripDelimiter && matchingDelimiter != null) {
result.writePosition(result.writePosition() - matchingDelimiter.length);
}
@@ -229,8 +228,6 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
}
/**
* Create a {@code StringDecoder} for {@code "text/plain"}.
* @param stripDelimiter this flag is ignored
@@ -293,8 +290,7 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
private static final DataBuffer BUFFER = DefaultDataBufferFactory.sharedInstance.wrap(new byte[0]);
private byte[] delimiter;
private final byte[] delimiter;
public EndFrameBuffer(byte[] delimiter) {
super(BUFFER);
@@ -304,7 +300,6 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
public byte[] delimiter() {
return this.delimiter;
}
}
@@ -313,7 +308,6 @@ public final class StringDecoder extends AbstractDataBufferDecoder<String> {
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
private final LimitedDataBufferList list;
LimitChecker(int maxInMemorySize) {
this.list = new LimitedDataBufferList(maxInMemorySize);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -30,9 +30,9 @@ import org.springframework.core.convert.converter.Converter;
*/
final class StringToBooleanConverter implements Converter<String, Boolean> {
private static final Set<String> trueValues = new HashSet<>(4);
private static final Set<String> trueValues = new HashSet<>(8);
private static final Set<String> falseValues = new HashSet<>(4);
private static final Set<String> falseValues = new HashSet<>(8);
static {
trueValues.add("true");
@@ -46,6 +46,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
falseValues.add("0");
}
@Override
public Boolean convert(String source) {
String value = source.trim();

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.
@@ -19,6 +19,7 @@ package org.springframework.core.convert.support;
import java.util.UUID;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
/**
@@ -31,6 +32,7 @@ import org.springframework.util.StringUtils;
final class StringToUUIDConverter implements Converter<String, UUID> {
@Override
@Nullable
public UUID convert(String source) {
return (StringUtils.hasText(source) ? UUID.fromString(source.trim()) : null);
}