Browse Source

Polishing

pull/35672/head
Juergen Hoeller 2 months ago
parent
commit
c53132ecdf
  1. 1
      spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessor.java
  2. 2
      spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java
  3. 2
      spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationPostProcessor.java
  4. 1
      spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringConstraintValidatorFactory.java
  5. 2
      spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java
  6. 85
      spring-core/src/main/java/org/springframework/core/io/buffer/DataBuffer.java
  7. 1
      spring-web/src/main/java/org/springframework/web/bind/support/SpringWebConstraintValidatorFactory.java
  8. 7
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java

1
spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessor.java

@ -87,7 +87,6 @@ public class AsyncAnnotationBeanPostProcessor extends AbstractBeanFactoryAwareAd @@ -87,7 +87,6 @@ public class AsyncAnnotationBeanPostProcessor extends AbstractBeanFactoryAwareAd
private Class<? extends Annotation> asyncAnnotationType;
public AsyncAnnotationBeanPostProcessor() {
setBeforeExistingAdvisors(true);
}

2
spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java

@ -69,8 +69,6 @@ import org.springframework.validation.method.ParameterValidationResult; @@ -69,8 +69,6 @@ import org.springframework.validation.method.ParameterValidationResult;
* at the type level of the containing target class, applying to all public service methods
* of that class. By default, JSR-303 will validate against its default group only.
*
* <p>This functionality requires a Bean Validation 1.1+ provider.
*
* @author Juergen Hoeller
* @author Rossen Stoyanchev
* @since 3.1

2
spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationPostProcessor.java

@ -60,8 +60,6 @@ import org.springframework.validation.method.MethodValidationResult; @@ -60,8 +60,6 @@ import org.springframework.validation.method.MethodValidationResult;
* inline constraint annotations. Validation groups can be specified through {@code @Validated}
* as well. By default, JSR-303 will validate against its default group only.
*
* <p>This functionality requires a Bean Validation 1.1+ provider.
*
* @author Juergen Hoeller
* @since 3.1
* @see MethodValidationInterceptor

1
spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringConstraintValidatorFactory.java

@ -56,7 +56,6 @@ public class SpringConstraintValidatorFactory implements ConstraintValidatorFact @@ -56,7 +56,6 @@ public class SpringConstraintValidatorFactory implements ConstraintValidatorFact
return this.beanFactory.createBean(key);
}
// Bean Validation 1.1 releaseInstance method
@Override
public void releaseInstance(ConstraintValidator<?, ?> instance) {
this.beanFactory.destroyBean(instance);

2
spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java

@ -55,8 +55,6 @@ import org.springframework.validation.SmartValidator; @@ -55,8 +55,6 @@ import org.springframework.validation.SmartValidator;
* {@link CustomValidatorBean} and {@link LocalValidatorFactoryBean},
* and as the primary implementation of the {@link SmartValidator} interface.
*
* <p>This adapter is fully compatible with Bean Validation 1.1 as well as 2.0.
*
* @author Juergen Hoeller
* @author Sam Brannen
* @since 3.0

85
spring-core/src/main/java/org/springframework/core/io/buffer/DataBuffer.java

@ -36,8 +36,9 @@ import org.springframework.util.Assert; @@ -36,8 +36,9 @@ import org.springframework.util.Assert;
* <p>{@code DataBuffer}s has a separate {@linkplain #readPosition() read} and
* {@linkplain #writePosition() write} position, as opposed to {@code ByteBuffer}'s
* single {@linkplain ByteBuffer#position() position}. As such, the {@code DataBuffer}
* does not require a {@linkplain ByteBuffer#flip() flip} to read after writing. In general,
* the following invariant holds for the read and write positions, and the capacity:
* does not require a {@linkplain ByteBuffer#flip() flip} to read after writing.
* In general, the following invariant holds for the read and write positions,
* and the capacity:
*
* <blockquote>
* {@code 0} {@code <=}
@ -46,12 +47,13 @@ import org.springframework.util.Assert; @@ -46,12 +47,13 @@ import org.springframework.util.Assert;
* <i>capacity</i>
* </blockquote>
*
* <p>The {@linkplain #capacity() capacity} of a {@code DataBuffer} is expanded on demand,
* similar to {@code StringBuilder}.
* <p>The {@linkplain #capacity() capacity} of a {@code DataBuffer} is expanded on
* demand, similar to {@code StringBuilder}.
*
* <p>The main purpose of the {@code DataBuffer} abstraction is to provide a convenient wrapper
* around {@link ByteBuffer} which is similar to Netty's {@link io.netty.buffer.ByteBuf} but
* can also be used on non-Netty platforms (i.e. Servlet containers).
* <p>The main purpose of the {@code DataBuffer} abstraction is to provide a
* convenient wrapper around {@link ByteBuffer} which is similar to Netty's
* {@link io.netty.buffer.ByteBuf} but can also be used on non-Netty platforms
* (i.e. Servlet containers).
*
* @author Arjen Poutsma
* @author Brian Clozel
@ -113,8 +115,8 @@ public interface DataBuffer { @@ -113,8 +115,8 @@ public interface DataBuffer {
* the current capacity, it will be expanded.
* @param capacity the new capacity
* @return this buffer
* @deprecated as of 6.0, in favor of {@link #ensureWritable(int)}, which
* has different semantics
* @deprecated as of 6.0, in favor of {@link #ensureWritable(int)}
* which has different semantics
*/
@Deprecated(since = "6.0")
DataBuffer capacity(int capacity);
@ -240,16 +242,16 @@ public interface DataBuffer { @@ -240,16 +242,16 @@ public interface DataBuffer {
DataBuffer write(byte b);
/**
* Write the given source into this buffer, starting at the current writing position
* of this buffer.
* Write the given source into this buffer, starting at the current writing
* position of this buffer.
* @param source the bytes to be written into this buffer
* @return this buffer
*/
DataBuffer write(byte[] source);
/**
* Write at most {@code length} bytes of the given source into this buffer, starting
* at the current writing position of this buffer.
* Write at most {@code length} bytes of the given source into this buffer,
* starting at the current writing position of this buffer.
* @param source the bytes to be written into this buffer
* @param offset the index within {@code source} to start writing from
* @param length the maximum number of bytes to be written from {@code source}
@ -258,8 +260,8 @@ public interface DataBuffer { @@ -258,8 +260,8 @@ public interface DataBuffer {
DataBuffer write(byte[] source, int offset, int length);
/**
* Write one or more {@code DataBuffer}s to this buffer, starting at the current
* writing position. It is the responsibility of the caller to
* Write one or more {@code DataBuffer}s to this buffer, starting at the
* current writing position. It is the responsibility of the caller to
* {@linkplain DataBufferUtils#release(DataBuffer) release} the given data buffers.
* @param buffers the byte buffers to write into this buffer
* @return this buffer
@ -267,8 +269,8 @@ public interface DataBuffer { @@ -267,8 +269,8 @@ public interface DataBuffer {
DataBuffer write(DataBuffer... buffers);
/**
* Write one or more {@link ByteBuffer} to this buffer, starting at the current
* writing position.
* Write one or more {@link ByteBuffer} to this buffer, starting at the
* current writing position.
* @param buffers the byte buffers to write into this buffer
* @return this buffer
*/
@ -321,36 +323,37 @@ public interface DataBuffer { @@ -321,36 +323,37 @@ public interface DataBuffer {
}
/**
* Create a new {@code DataBuffer} whose contents is a shared subsequence of this
* data buffer's content. Data between this data buffer and the returned buffer is
* shared; though changes in the returned buffer's position will not be reflected
* in the reading nor writing position of this data buffer.
* Create a new {@code DataBuffer} whose contents is a shared subsequence
* of this data buffer's content. Data between this data buffer and the
* returned buffer is shared; though changes in the returned buffer's
* position will not be reflected in the reading nor writing position
* of this data buffer.
* <p><strong>Note</strong> that this method will <strong>not</strong> call
* {@link DataBufferUtils#retain(DataBuffer)} on the resulting slice: the reference
* count will not be increased.
* {@link DataBufferUtils#retain(DataBuffer)} on the resulting slice:
* the reference count will not be increased.
* @param index the index at which to start the slice
* @param length the length of the slice
* @return the specified slice of this data buffer
* @deprecated as of 6.0, in favor of {@link #split(int)}, which
* has different semantics
* @deprecated as of 6.0, in favor of {@link #split(int)}
* which has different semantics
*/
@Deprecated(since = "6.0")
DataBuffer slice(int index, int length);
/**
* Create a new {@code DataBuffer} whose contents is a shared, retained subsequence of this
* data buffer's content. Data between this data buffer and the returned buffer is
* shared; though changes in the returned buffer's position will not be reflected
* in the reading nor writing position of this data buffer.
* Create a new {@code DataBuffer} whose contents is a shared, retained subsequence
* of this data buffer's content. Data between this data buffer and the returned
* buffer is shared; though changes in the returned buffer's position will not be
* reflected in the reading nor writing position of this data buffer.
* <p><strong>Note</strong> that unlike {@link #slice(int, int)}, this method
* <strong>will</strong> call {@link DataBufferUtils#retain(DataBuffer)} (or equivalent) on the
* resulting slice.
* <strong>will</strong> call {@link DataBufferUtils#retain(DataBuffer)}
* (or equivalent) on the resulting slice.
* @param index the index at which to start the slice
* @param length the length of the slice
* @return the specified, retained slice of this data buffer
* @since 5.2
* @deprecated as of 6.0, in favor of {@link #split(int)}, which
* has different semantics
* @deprecated as of 6.0, in favor of {@link #split(int)}
* which has different semantics
*/
@Deprecated(since = "6.0")
default DataBuffer retainedSlice(int index, int length) {
@ -359,12 +362,10 @@ public interface DataBuffer { @@ -359,12 +362,10 @@ public interface DataBuffer {
/**
* Splits this data buffer into two at the given index.
*
* <p>Data that precedes the {@code index} will be returned in a new buffer,
* while this buffer will contain data that follows after {@code index}.
* Memory between the two buffers is shared, but independent and cannot
* overlap (unlike {@link #slice(int, int) slice}).
*
* <p>The {@linkplain #readPosition() read} and
* {@linkplain #writePosition() write} position of the returned buffer are
* truncated to fit within the buffers {@linkplain #capacity() capacity} if
@ -384,22 +385,22 @@ public interface DataBuffer { @@ -384,22 +385,22 @@ public interface DataBuffer {
* will not be reflected in the reading nor writing position of this data buffer.
* @return this data buffer as a byte buffer
* @deprecated as of 6.0, in favor of {@link #toByteBuffer(ByteBuffer)},
* {@link #readableByteBuffers()}, or {@link #writableByteBuffers()}.
* {@link #readableByteBuffers()} or {@link #writableByteBuffers()}
*/
@Deprecated(since = "6.0")
ByteBuffer asByteBuffer();
/**
* Expose a subsequence of this buffer's bytes as a {@link ByteBuffer}. Data between
* this {@code DataBuffer} and the returned {@code ByteBuffer} is shared; though
* changes in the returned buffer's {@linkplain ByteBuffer#position() position}
* Expose a subsequence of this buffer's bytes as a {@link ByteBuffer}. Data
* between this {@code DataBuffer} and the returned {@code ByteBuffer} is shared;
* though changes in the returned buffer's {@linkplain ByteBuffer#position() position}
* will not be reflected in the reading nor writing position of this data buffer.
* @param index the index at which to start the byte buffer
* @param length the length of the returned byte buffer
* @return this data buffer as a byte buffer
* @since 5.0.1
* @deprecated as of 6.0, in favor of {@link #toByteBuffer(int, ByteBuffer, int, int)},
* {@link #readableByteBuffers()}, or {@link #writableByteBuffers()}.
* {@link #readableByteBuffers()} or {@link #writableByteBuffers()}
*/
@Deprecated(since = "6.0")
ByteBuffer asByteBuffer(int index, int length);
@ -553,6 +554,7 @@ public interface DataBuffer { @@ -553,6 +554,7 @@ public interface DataBuffer {
void close();
}
/**
* Process a range of bytes one by one.
* @since 6.2.12
@ -565,10 +567,9 @@ public interface DataBuffer { @@ -565,10 +567,9 @@ public interface DataBuffer {
* should continue further.
* @param b a byte from the {@link DataBuffer}
* @return {@code true} if processing should continue,
* or {@code false} if processing should stop at this element.
* or {@code false} if processing should stop at this element
*/
boolean process(byte b);
}
}

1
spring-web/src/main/java/org/springframework/web/bind/support/SpringWebConstraintValidatorFactory.java

@ -44,7 +44,6 @@ public class SpringWebConstraintValidatorFactory implements ConstraintValidatorF @@ -44,7 +44,6 @@ public class SpringWebConstraintValidatorFactory implements ConstraintValidatorF
return getWebApplicationContext().getAutowireCapableBeanFactory().createBean(key);
}
// Bean Validation 1.1 releaseInstance method
@Override
public void releaseInstance(ConstraintValidator<?, ?> instance) {
getWebApplicationContext().getAutowireCapableBeanFactory().destroyBean(instance);

7
spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java

@ -431,11 +431,10 @@ public class XsltView extends AbstractUrlBasedView { @@ -431,11 +431,10 @@ public class XsltView extends AbstractUrlBasedView {
private Templates loadTemplates() throws ApplicationContextException {
Source stylesheetSource = getStylesheetSource();
try {
Templates templates = getTransformerFactory().newTemplates(stylesheetSource);
return templates;
return getTransformerFactory().newTemplates(stylesheetSource);
}
catch (TransformerConfigurationException ex) {
throw new ApplicationContextException("Can't load stylesheet from '" + getUrl() + "'", ex);
throw new ApplicationContextException("Cannot load stylesheet from '" + getUrl() + "'", ex);
}
finally {
closeSourceIfNecessary(stylesheetSource);
@ -474,7 +473,7 @@ public class XsltView extends AbstractUrlBasedView { @@ -474,7 +473,7 @@ public class XsltView extends AbstractUrlBasedView {
return new StreamSource(resource.getInputStream(), resource.getURI().toASCIIString());
}
catch (IOException ex) {
throw new ApplicationContextException("Can't load XSLT stylesheet from '" + url + "'", ex);
throw new ApplicationContextException("Cannot load XSLT stylesheet from '" + url + "'", ex);
}
}

Loading…
Cancel
Save