Commit Graph

2344 Commits

Author SHA1 Message Date
Sam Brannen 2b6117c0c2 Fix Checkstyle violation
See gh-24393
2020-02-04 13:45:02 +01:00
Sam Brannen 72685b1d81 Polish contribution
See gh-24393
2020-02-04 13:41:31 +01:00
Hyunjin Choi d624dc084f
Add close() method in FileCopyUtils to reduce duplication
Closes gh-24393
2020-02-04 13:36:24 +01:00
Hyunjin Choi 550f13e8ed
Simplify GenericConversionService.getMatchableConverters()
Closes gh-24403
2020-02-04 12:59:57 +01:00
Rossen Stoyanchev f5df422de9 Polishing contribution
See gh-24470
2020-02-03 20:32:36 +00:00
Hyunjin Choi 273812f9c5 Remove unnecessary escapes in regular expressions
See gh-24470
2020-02-03 20:22:40 +00:00
Sam Brannen cf9a052e3a Polish contribution
See gh-24428
2020-02-03 15:39:00 +01:00
Hyunjin Choi 1b39f138eb
Test ObjectUtils.containsElement()
This commit introduces a unit test for the containsElement() method
in ObjectUtils.

Closes gh-24428
2020-02-03 15:34:47 +01:00
Hyunjin Choi 14a32d13d0
Fix typo in StringUtils class
Closes gh-24471
2020-02-03 15:23:32 +01:00
Sam Brannen d77a28aac3 Support optional command line arguments with empty values
Spring Framework provides two implementations of the
CommandLinePropertySource API: SimpleCommandLinePropertySource and
JOptCommandLinePropertySource.

Prior to this commit, JOptCommandLinePropertySource supported empty
values for optional arguments; whereas, SimpleCommandLinePropertySource
did not.

This commit modifies the implementation of SimpleCommandLinePropertySource
to allow empty values for optional arguments.

Closes gh-24464
2020-02-03 15:03:43 +01:00
Sam Brannen daebbf1960 Polishing 2020-01-31 14:34:50 +01:00
Сергей Цыпанов 64440a5f04 Some trivial improvements to reduce allocation pressure
Closes gh-24447
2020-01-28 11:07:40 +01:00
Juergen Hoeller 75abd9fc7e Upgrade to ASM 7.3
Closes gh-24438
2020-01-27 18:18:16 +01:00
Kalmesh Sambrani d085577e0a Solve ReflectPermission Issue in Sandbox Security Policy Model 2020-01-24 14:15:39 +01:00
Sam Brannen b34404916a Update copyright date 2020-01-17 18:15:16 +01:00
Сергей Цыпанов 3adc7c3059 Hoist concatenation of two constant Strings out of loops
Closes gh-24388
2020-01-17 16:59:39 +01:00
Sam Brannen daa30a9f0b Consistent use of AnnotationUtils.rethrowAnnotationConfigurationException()
Closes gh-24379
2020-01-16 18:19:11 +01:00
Sam Brannen 6c2cb8ecf5 Polish contribution
See gh-24351
2020-01-14 17:33:02 +01:00
hyeonisism f1827cb1f9 Add tests for StringUtils split() method
Closes gh-24351
2020-01-14 17:20:38 +01:00
Sam Brannen 33ffdd865d Update copyright date 2020-01-13 16:29:23 +01:00
Qimiao Chen c84dd55863 Fix typo in ReflectionUtilsTests
Closes gh-24344
2020-01-13 16:27:05 +01:00
Rossen Stoyanchev cbc57460b7 Support for maxInMemorySize in SSE reader
Closes gh-24312
2020-01-13 14:57:14 +00:00
Rossen Stoyanchev a741ae422b Improve limit handling in StringDecoder
The case of one data buffer containing multiple lines can could cause
a buffer leak due to a suspected issue in concatMapIterable. This
commit adds workarounds for that until the underlying issue is
addressed.

Closes gh-24339
2020-01-13 14:57:14 +00:00
Sam Brannen cb8db1e6df Polish Javadoc 2020-01-10 16:05:33 +01:00
Juergen Hoeller 4936a637fe Polishing 2020-01-09 17:03:17 +01:00
Juergen Hoeller c39ed52f97 Add since tag to hasMethod(Class, Method)
See gh-24282
2020-01-08 19:05:03 +01:00
stsypanov 8e5cad2af3 Add fast path for ClassUtils.hasMethod() 2020-01-08 18:52:15 +01:00
Rossen Stoyanchev 01827389ef Polishing contribution
See gh-24292
2020-01-08 16:19:25 +00:00
Oleh Faizulin e96b71acf3 contentLength support for Resource decoding
Expose the known content length, if known, in the InputStreamResource returned by ResourceHttpMessageConverter or
ResourceDecoder.

See gh-24292
2020-01-08 16:19:11 +00:00
Sam Brannen 3299793c8a Polish [Simple]AliasRegistry[Tests] 2020-01-06 11:30:05 +01:00
Qimiao Chen d0c2812dad Optimize SimpleAliasRegistry hasAlias implementation
This commit reduces the number of loops and recursions in
the implementation of SimpleAliasRegistry#hasAlias().

Closes gh-24295
2020-01-06 11:28:24 +01:00
Sam Brannen 081b3d304d Move JavaUtilLoggingConfigurer to spring-core test fixtures
See gh-23550
2020-01-03 14:34:29 +01:00
Sam Brannen 94f8ef08e2 Move common TestPrincipal to spring-core test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Rossen Stoyanchev 0eacb443b0 Reuse InputStream in ResourceRegionHttpMessageConverter
The converter now tries to keep reading from the same InputStream which
should be possible with ordered and non-overlapping regions. When
necessary the InputStream is re-opened.

Closes gh-24214
2019-12-18 16:22:53 +00:00
Juergen Hoeller 0711e58a5f Un-deprecate PathResource (for NIO Path resolution in createRelative)
Includes aligned createRelative signature and dedicated java.io.File test.

Closes gh-24211
2019-12-16 16:50:04 +01:00
Juergen Hoeller f353bc0c25 ConcurrentReferenceHashMap cache for getInterfaceMethodIfPossible results
Closes gh-24206
2019-12-16 16:49:39 +01:00
Sam Brannen 17edbec035 Polishing 2019-12-13 16:30:03 +01:00
Sam Brannen 49ddf798e0 Polish ClassUtils.resolvePrimitiveClassName()
See gh-24192
2019-12-13 15:47:05 +01:00
Juergen Hoeller fa8f08391f Consistent use of annotation-api dependency instead of tomcat-embed-core 2019-12-12 17:21:41 +01:00
Sam Brannen d757f73902 Handle exceptions in annotation searches again
Prior to Spring Framework 5.2, most annotation search algorithms made
use of AnnotationUtils.handleIntrospectionFailure() to handle exceptions
thrown while attempting to introspect annotation metadata. With the
introduction of the new MergedAnnotation API in Spring Framework 5.2,
this exception handling was accidentally removed.

This commit introduces the use of handleIntrospectionFailure() within
the new MergedAnnotation internals in order to (hopefully) align with
the previous behavior.

Closes gh-24188
2019-12-12 11:29:06 +01:00
Sam Brannen 6e21b19999 Make TYPE_HIERARCHY_AND_ENCLOSING_CLASSES annotation search strategy defensive
Prior to this commit, when searching for annotations using the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy an exception could be
thrown while attempting to load the enclosing class (e.g., a
NoClassDefFoundError), thereby halting the entire annotation scanning
process.

This commit makes this search strategy defensive by logging exceptions
encountered while processing the enclosing class hierarchy instead of
allowing the exception to halt the entire annotation scanning process.

The exception handling is performed by
AnnotationUtils.handleIntrospectionFailure() which only allows an
AnnotationConfigurationException to propagate.

See gh-24136
2019-12-10 22:38:55 +01:00
Sam Brannen 16ed7e2a19 Only load enclosing class for TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy
Prior to this commit, the enclosing class was always eagerly loaded
even if the annotation search strategy was not explicitly
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES.

See gh-24136
2019-12-10 22:08:26 +01:00
Sam Brannen 76bc581528 Polishing 2019-12-10 22:06:22 +01:00
Sam Brannen 2bd821c909 Improve exception for mixed explicit/implicit aliases with @AliasFor
Given the following improperly configured composed @RequestMapping
annotation:

@Retention(RetentionPolicy.RUNTIME)
@RequestMapping
@interface PostApi {

	@AliasFor("value")
	String[] path() default {};

	@AliasFor(annotation = RequestMapping.class, attribute = "path")
	String[] value() default {};
}

Prior to this commit, an attempt to process the above annotation
resulted in an exception similar to the following, which is not
especially helpful to discern the problem.

> Attribute 'value' in annotation [PostApi] must be declared as an
> @AliasFor 'path', not 'path'.

This commit improves the exception message for such scenarios,
resulting in an exception message similar to the following.

> Attribute 'value' in annotation [PostApi] must be declared as an
> @AliasFor attribute 'path' in annotation [PostApi], not attribute
> 'path' in annotation [RequestMapping].

Closes gh-24168
2019-12-10 14:36:11 +01:00
Sam Brannen 4466114cfa Polishing 2019-12-10 14:26:48 +01:00
Juergen Hoeller 2c03246f00 Polishing 2019-12-09 15:58:21 +01:00
Juergen Hoeller 2d2993dffb Cleanup of "varaible" typos in ResolvableTypeTests 2019-12-09 14:03:56 +01:00
Juergen Hoeller a4f75e9c6a Polishing 2019-12-09 13:29:00 +01:00
stsypanov ebbb562cb9 Hoist constant result of SerializableTypeWrapper.unwrap() out of loop 2019-12-09 13:14:10 +01:00
PyvesB e15ccdb35d Polish DataBufferUtils javadoc
See gh-24160
2019-12-08 14:01:55 +01:00
stsypanov 484006ce90 Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution 2019-12-06 17:36:07 +01:00
Phillip Webb 7c84695333 Support variable resolution of wildcard types
Update `ResolvableType` so that variable referenced can be resolved
against wildcard types. Prior to this commit, given a type:

	Map<String, ? extends List<? extends CharSequence>>

Calling `type.getGeneric(1).asCollection().resolveGeneric()` would
return `null`. This was because the `List` variable `E` referenced a
wildcard type which `resolveVariable` did not support.

Closes gh-24145
2019-12-06 13:38:46 +01:00
Sam Brannen a4fa6a7a31 Test status quo for @Inherited annotation support in AnnotationMetadata 2019-12-05 23:30:14 +01:00
Sam Brannen 3b9d1a00b0 Polishing 2019-12-05 22:37:00 +01:00
Juergen Hoeller c2141e2e93 Add @since tags to firstElement methods 2019-12-05 16:36:55 +01:00
Vitalii Rastvorov d503bc2804 Add firstElement to CollectionUtils 2019-12-05 16:26:25 +01:00
Sam Brannen fb13f6f0bc Add integration test for gh-24110 2019-12-03 16:48:30 +01:00
wanxiangming1994 6f15f32be3 Honor default values for implicit aliases in composed annotations
Spring Framework 5.2 introduced a regression for implicit aliases
declared via @AliasFor. Specifically, Spring's merged annotation
algorithms stopped honoring default values for implicit alias pairs if
the composed annotation was used without specifying the aliased
attributes.

This commit fixes this regression.

Closes gh-24110
2019-12-03 16:14:49 +01:00
Sam Brannen 279777b2f3 Polishing 2019-12-02 16:22:40 +01:00
Sam Brannen d9ebc3bbc4 Polish StringArrayPropertyEditor[Tests] 2019-11-29 14:55:18 +01:00
Sam Brannen 7cedffc707 Support @Inherited again in reflection-based AnnotationMetadata
Spring Framework 5.2 introduced a regression in reflection-based
AnnotationMetadata. Specifically, as of 5.2, StandardAnnotationMetadata
no longer found @Inherited annotations from superclasses.

This commit fixes this regression by switching to the INHERITED_ANNOTATIONS
SearchStrategy when creating the MergedAnnotations used within
StandardAnnotationMetadata,

Note, however, that the discrepancy between StandardAnnotationMetadata
and SimpleAnnotationMetadata (i.e., reflection-based vs. ASM-based)
regarding @Inherited support still remains as it was prior to Spring
Framework 5.2.

Closes gh-24077
2019-11-29 00:07:44 +01:00
Sam Brannen 85016aef30 Test status quo for @Inherited annotations in AnnotationMetadata
This commit introduces failing assertions that are currently disabled
via a boolean reproduceGh24077 flag.

Setting that flag to true demonstrates the regression for
StandardAnnotationMetadata and inconsistencies for SimpleAnnotationMetadata.

See gh-24077
2019-11-28 18:45:58 +01:00
Sam Brannen d1f544209e Test status quo for AnnotatedTypeMetadata.getAnnotationAttributes()
See gh-24077
2019-11-28 13:50:35 +01:00
Sébastien Deleuze 712eac2915 Refine Coroutines annotated controller support
This commit refines Coroutines annotated controller support
by considering Kotlin Unit as Java void and using the right
ReactiveAdapter to support all use cases, including suspending
functions that return Flow (usual when using APIs like WebClient).

It also fixes RSocket fire and forget handling and adds related tests
for that use case.

Closes gh-24057
Closes gh-23866
2019-11-22 14:13:17 +01:00
Juergen Hoeller 06b1f31cdd SynthesizedMergedAnnotationInvocationHandler does not pre-load values
Closes gh-24029
2019-11-19 14:54:12 +01:00
Juergen Hoeller 4af6039359 Avoid substring allocation in StringUtils.replace
Closes gh-24023
2019-11-19 14:53:30 +01:00
Juergen Hoeller 830f81210f Revise getElementTypeDescriptor javadoc (no IllegalStateException)
Closes gh-23996
2019-11-14 18:31:32 +01:00
Sébastien Deleuze 029e61f54a Refine MethodParameter#isOptional Kotlin implementation
This commit adds support for Continuation parameter that is now
considered as an optional parameter since it is never provided by
the user.

It also simplifies and optimizes the implementation.

Closes gh-23991
2019-11-14 15:28:06 +01:00
Juergen Hoeller 22211a01ce Polishing 2019-11-13 17:23:23 +01:00
Rossen Stoyanchev f2b9264674 Remove Jetbrains annotations 2019-11-13 14:42:32 +00:00
Sébastien Deleuze 7646895fd4 Support Kotlin synthetic classes in MethodParameter and SpEL
Closes gh-23812
2019-11-13 14:22:53 +01:00
stsypanov f2b3953d76 Use array.clone() instead of manual array creation 2019-11-13 13:53:42 +01:00
Juergen Hoeller 9cc06454aa Restore findAnnotation superclass traversal for java.lang annotations
Closes gh-23929
2019-11-12 11:51:44 +01:00
Arjen Poutsma 789f6fc188 Add @Nullable annotation to decode method taking DataBuffer
Javadoc indicates the returned value can be null.
2019-11-11 16:48:30 +01:00
Andy Wilkinson b5fb28284e Upgrade to Shadow Plugin 5.2.0
Closes gh-23971
2019-11-11 14:56:40 +01:00
Juergen Hoeller 6a48bb7b4d Polishing 2019-11-07 22:08:29 +01:00
stsypanov f5ae3c77c6 Use Method::getParameterCount where possible 2019-11-07 18:00:15 +01:00
Sam Brannen 29b31cad48 Align implementations of StringToUUIDConverter and UUIDEditor
Closes gh-23940
2019-11-06 14:21:52 +01:00
Sam Brannen 01fb35bd2d Remove TestGroup.CI enum constant
Prior to this commit, the TestGroup.CI enum constant was only used in a
single test method in spring-core. In order to enable that test, the
`testGroups` JVM system property was configured for the
Publication-master CI build plan; however, the `testGroups` system
property is not set when executing local builds. Consequently, there
has been a Gradle cache miss for every `test` task when building
something locally that's already been built on the CI server.

This commit addresses this issue by removing the `TestGroup.CI` enum
constant. The `-PtestGroups=ci` command line configuration for the
Publication-master CI build plan has also been removed on the CI server.

Closes gh-23918
2019-11-04 15:44:53 +01:00
François Guillot 2411b657ae Fix spring-core jar task 'up-to-date'-ness
See gh-23729
2019-11-04 10:29:58 +01:00
Sam Brannen 95af079906 Document unidirectional @AliasFor attribute mapping support
See gh-23834
2019-10-31 15:27:27 +01:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller 19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Juergen Hoeller 42e7ade110 Tolerate unidirectional alias declaration for annotation attribute pair
Closes gh-23834
2019-10-30 14:31:09 +01:00
Juergen Hoeller dba7bf7ec1 Avoid unnecessary setAccessible call in AttributeMethods
Closes gh-23829
2019-10-30 14:30:26 +01:00
Juergen Hoeller dc59e50561 Avoid unnecessary use of ResolvableType within MethodParameter
Closes gh-23792
2019-10-30 01:04:26 +01:00
Juergen Hoeller d51ab24a1b Latest dependency updates (Tomcat 9.0.27, Undertow 2.0.27, RxJava 2.2.13, Gson 2.8.6, Apache Johnzon 1.2.1, Hibernate ORM 5.4.8, EclipseLink 2.7.5, H2 1.4.200, POI 4.1.1, Quartz 2.3.2, WebJars Locator 0.42, HtmlUnit 2.36, Checkstyle 8.26, Mockito 3.1, Objenesis 3.1) 2019-10-30 00:26:45 +01:00
Rossen Stoyanchev 5abf24e7d7 Expose maxInMemorySize via CodecConfigurer
Centralized maxInMemorySize exposed via CodecConfigurer along with
ability to plug in an instance of MultipartHttpMessageWrite.

Closes gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel 69bcdfc17f Polishing 2019-10-29 12:33:16 +00:00
Rossen Stoyanchev 89d053d7f4 Limits on input stream in codecs
- Add maxInMemorySize property to Decoder and HttpMessageReader
  implementations that aggregate input to trigger
  DataBufferLimitException when reached.

- For codecs that call DataBufferUtils#join, there is now an overloaded
  variant with a maxInMemorySize extra argument. Internally, a custom
  LimitedDataBufferList is used to count and enforce the limit.

- Jackson2Tokenizer and XmlEventDecoder support those limits per
  streamed JSON object.

See gh-23884
2019-10-29 12:33:16 +00:00
Phillip Webb 013ec6abdb Support customer repeatable containers in type map
Update `AnnotationTypeMappings` so that a custom `RepeatableContainers`
instances can be used. Prior to this commit, only standard repeatables
were used when reading the annotations. This works in most situations,
but causes regressions for some `AnnotationUtils` methods.

Fixed gh-23856
2019-10-24 13:20:11 -07:00
Sam Brannen f8b875d2d8 Introduce failing @Disabled test for gh-23856 2019-10-24 16:15:59 +02:00
Sam Brannen 71400ea604 Polish MergedAnnotation internals 2019-10-22 13:58:13 +02:00
Sam Brannen 2146bc816a Fix Checkstyle violations
See gh-23767
2019-10-22 12:40:38 +02:00
Phillip Webb ad543dbee3 Use mapped annotation values when resolving mirrors
Update `TypeMappedAnnotation` mirror resolution logic so that mapped
annotation values are also considered. Prior to this commit, mirrors
in more complex meta-annotation scenarios would not resolve correctly.

Specifically, given the following:

 @interface TestAliased {

 	@AliasFor(attribute = "qualifier")
 	String value() default "";

 	@AliasFor(attribute = "value")
 	String qualifier() default "";
 }

 @TestAliased
 @interface TestMetaAliased {

 	@AliasFor(annotation = Aliased.class, attribute = "value")
 	String value() default "";
 }

 @TestMetaAliased("test")
 @interface TestComposed {
 }

A merged `@TestAliased` annotation obtained from a `@TestComposed`
root annotation would return a `value` and `qualifier` of "".

This was because the "value" and "qualifier" mirrors needed to be
resolved against the `@TestMetaAliased` meta-annotation. They cannot be
resolved against the declared `@TestComposed` annotation because it
does not have any attributes. Our previous tests only covered a single
depth scenario where `@TestMetaAliased` was used directly on the
annotated element.

Closes gh-23767
Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-10-21 21:57:30 -07:00
Sam Brannen b1a938fa24 Polishing 2019-10-21 13:51:37 -07:00
Stephane Nicoll 29f0d1b25e Remove TODO in AnnotationUtils
Closes gh-23727
2019-09-30 07:57:12 +02:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sam Brannen 2526553ecd Document terms and units in DataSize and DataUnit
Prior to this commit, it was not readily apparent what terms and units
such as kilobyte/KB and megabyte/MB represented numerically in DataSize
and DataUnit.

This commit clarifies that such terms and units are based on binary
prefixes for data (i.e., powers of 2 instead of powers of 10).

Closes gh-23697
2019-09-26 16:05:12 +02:00
Sam Brannen 77b896ca28 Polishing 2019-09-26 11:58:45 +02:00
Sebastien Deleuze 091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Juergen Hoeller bd70f10d2b Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-aspects/spring-aspects.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
2019-09-25 12:43:24 +02:00
Juergen Hoeller bb6f9bb6d4 Polishing 2019-09-25 12:14:48 +02:00
Sam Brannen e6678f40e8 Make DataSize constants final 2019-09-24 15:32:26 +02:00
Sam Brannen 402046f3c7 Polish data buffer allocation tests 2019-09-24 14:24:36 +02:00
Sam Brannen bba3553dfb Polish SpringVersion 2019-09-24 12:43:10 +02:00
Sam Brannen 4acd180fa3 Document that setting static final fields is unsupported
This commit updates the documentation for ReflectionUtils and
ReflectionTestUtils to point out that setting static final fields is
not supported.
2019-09-21 15:42:09 +02:00
Sam Brannen fccdb8cf60 Polish ReflectionUtils
This commit removes dead code in ReflectionUtils and improves the
exception message for field access errors.
2019-09-21 15:29:03 +02:00
Juergen Hoeller 4882dfcc0d Consistent relative path treatment (no accidental URL fragment symbol)
Closes gh-23532
2019-09-20 21:55:27 +02:00
Juergen Hoeller 957924ace2 Avoid early log provider initialization (and LogAccessor dependency)
Closes gh-23655
2019-09-20 21:54:53 +02:00
Stephane Nicoll 37d950c5d6 Merge branch '5.1.x' 2019-09-16 14:37:15 +02:00
Stephane Nicoll b65984a078 Consume getProtocolResolvers() rather than internal list
This commit makes sure that DefaultResourceLoader consistently use
getProtocolResolvers() to access additional protocol resolvers. This
allows subclasses to define how the list is provided.

Closes gh-23564
2019-09-16 14:35:00 +02:00
Phillip Webb d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Sam Brannen d09f537699 Annotate Object#equals parameter with @nullable
See gh-23093

Co-authored-by: Sebastien Deleuze <sdeleuze@pivotal.io>
2019-09-16 12:43:13 +02:00
Juergen Hoeller c8f20815ef Revise LinkedCaseInsensitiveMap's lazy key/value/entry collections
Closes gh-22926
2019-09-16 12:38:46 +02:00
Juergen Hoeller 60976e4116 Add missing nullable declarations
See gh-22821
2019-09-16 12:37:49 +02:00
Phillip Webb aa69703f3b Fix LinkedCaseInsensitiveMap collection methods
Ensure that results returned from keySet, entrySet & values are tracked
to remove case insensitive keys from the source map.

Closes gh-22821
2019-09-16 12:36:05 +02:00
Sam Brannen 957f0fac7a Polishing 2019-09-13 12:55:59 +02:00
Sam Brannen 30cff46e7f Prevent improper use of testing framework APIs
Prior to this commit, a lot of work had been done to prevent improper
use of testing Framework APIs throughout the codebase; however, there
were still some loopholes.

This commit addresses these loopholes by introducing additional
Checkstyle rules (and modifying existing rules) to prevent improper use
of testing framework APIs in production code as well as in test code.

- Checkstyle rules for banned imports have been refactored into
  multiple rules specific to JUnit 3, JUnit 4, JUnit Jupiter, and
  TestNG.
- Accidental usage of org.junit.Assume has been switched to
  org.junit.jupiter.api.Assumptions.
- All test classes now reside under org.springframework packages.
- All test classes (including abstract test classes) now conform to the
  `*Tests` naming convention.
  - As an added bonus, tests in the renamed
    ScenariosForSpringSecurityExpressionTests are now included in the
    build.
- Dead JUnit 4 parameterized code has been removed from
  DefaultServerWebExchangeCheckNotModifiedTests.

Closes gh-22962
2019-09-12 11:20:56 +02:00
Sam Brannen 333711fd36 Convert XmlValidationModeDetectorTests to JUnit Jupiter and AssertJ
See gh-23605
2019-09-09 16:29:00 +02:00
Sam Brannen 22c88d7126 Merge branch '5.1.x' 2019-09-09 16:25:20 +02:00
Sam Brannen 961010055e Support trailing comment in DTD declaration in XML config
Prior to this commit, Spring failed to determine that an XML config file
was DTD-based if the DTD declaration was followed by a comment.

This commit fixes this by modifying the consumeCommentTokens(String)
algorithm in XmlValidationModeDetector so that both leading and trailing
comments are properly consumed without losing any XML content.

Closes gh-23605
2019-09-09 16:18:21 +02:00
Sam Brannen 591995ecc8 Polish and revive disabled tests
This commit revives some previously disabled tests and converts
some usage of @Disabled to @EnabledForTestGroups(...).
2019-09-06 15:57:27 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sam Brannen 07d4104f2f Polishing 2019-09-04 14:12:44 +02:00
Rossen Stoyanchev 310f0bfb6c Remove unnecessary code from prior commit 2019-09-04 12:59:19 +01:00
Rossen Stoyanchev dfc7540106 Add generic type bounds to DataBufferUtils methods
Closes gh-23459
2019-09-04 12:14:32 +01:00
Juergen Hoeller 3bc27e8d14 Streamline AnnotationFilter usage with the MergedAnnotations API
MergedAnnotations provides 'from' variants with RepeatableContainers but without AnnotationFilter argument now, avoiding the need to refer to AnnotationFilter.PLAIN as a default at call sites.
2019-09-04 12:18:49 +02:00
Rossen Stoyanchev c8f430ee91 Change package used to test path matching
The org.reactivestreams has 13 instead of 4 classes in 1.0.3 with the
addition of Java 9 Flow adapters. This commit switches to using a
different package reactor.util.annotation, also with a small number of
classes, for this test.
2019-09-04 10:37:57 +01:00
Sebastien Deleuze 9b33b0ad58 Rename CoroutinesUtils#invokeHandlerMethod to invokeSuspendingFunction 2019-09-03 23:41:53 +02:00
Sam Brannen aeb857c3ba Polish ClassUtilsTests
See gh-23572
2019-09-03 17:58:54 +02:00
Sam Brannen c78960a1ba Merge branch '5.1.x' 2019-09-03 14:21:39 +02:00
Sam Brannen f37ec90f2f Consider Void.class a primitive wrapper in ClassUtils
Prior to this commit, ClassUtils.isPrimitiveOrWrapper() and
ClassUtils.isPrimitiveWrapper() did not return true for Void.class.
However, ClassUtils.isPrimitiveOrWrapper() did return true for
void.class. This lacking symmetry is inconsistent and can lead to bugs
in reflective code.

See: https://github.com/spring-projects/spring-data-r2dbc/issues/159

This commit addresses this by adding an entry for Void.class -> void.class
in the internal primitiveWrapperTypeMap in ClassUtils.

Closes gh-23572
2019-09-03 14:02:24 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sebastien Deleuze ca02cc1194 Migrate to AssertJ in Kotlin tests
Closes gh-23475
2019-09-02 15:59:26 +02:00
Arjen Poutsma 3fcf4233a2 Merge branch '5.1.x' 2019-09-02 15:19:30 +02:00
Arjen Poutsma f748b1e68d Fix timing bug in DataBufferUtils::readAsynchronousFileChannel
This commit makes sure that reading is enabled after the current
signal has been processed, not while is is being processed. The bug
was only apparent while using the JettyClientHttpConnector, which
requests new elements continuously, even after the end of the
stream has been signalled.
2019-09-02 15:13:22 +02:00
Arjen Poutsma 702dad6cec Fix ConcurrentModificationException 2019-09-02 12:42:21 +02:00
Arjen Poutsma 67d48ed821 Merge branch '5.1.x' 2019-08-29 17:18:22 +02:00
Arjen Poutsma 2c5958e191 Support back pressure in DataBufferUtils::readAsynchronousFileChannel
This commit adds support for back pressure in the ReadCompletionHandler,
as used by DataBufferUtils::readAsynchronousFileChannel.

See gh-23518
2019-08-29 16:34:36 +02:00
OLPMO ed64a10c38 Use Collections.addAll where feasible
Closes gh-23478
2019-08-29 13:59:14 +02:00
Sam Brannen c004ef888c Configure index in @ParameterizedTest display names
This commit prepends "[{index}] " to all custom display names
configured via @ParameterizedTest.

This provides better diagnostics between the "technical names" reported
on the CI server vs. the "display names" reported within a developer's
IDE.

See gh-23451
2019-08-28 17:06:23 +02:00
Sam Brannen b173a93e72 Verify PathMatchingResourcePatternResolver finds local files with # in name
This commit introduces a test that verifies that
PathMatchingResourcePatternResolver can find files in the filesystem
that contain hashtags (#) in their names.

See gh-23532
2019-08-28 16:21:07 +02:00
Sebastien Deleuze 77da40f006 Upgrade to Coroutines 1.3.0
Closes gh-23535
2019-08-28 13:30:40 +02:00
stsypanov 78d56dc61b Use Arrays.copyOf and Arrays.copyOfRange where possible
Closes gh-23393
2019-08-27 19:18:39 +02:00
Сергей Цыпанов 6ef75d76cd Simplify String concatenation
Closes gh-23470
2019-08-27 18:22:44 +02:00
Sam Brannen bfbe84d1c6 Apply fudge factor on both ends of the spectrum in StopWatchTests
This is an attempt to solve a build issue on Microsoft Windows.

See gh-23507
2019-08-23 16:50:27 +02:00
Sam Brannen ad6231ad29 Add missing @Override annotations 2019-08-23 13:50:58 +02:00
Brian Clozel 86c734785d Apply Artifactory Gradle plugin
Instead of relying on the CI server to apply and configure this plugin,
this commit does it directly in the Spring Framework build.
This allows us to take full control over which projects are published
and how.

See gh-23282
2019-08-21 20:15:35 +02:00
Brian Clozel 7ce1f5e652 Configure Maven publications with Gradle
Prior to this commit, the build would use a custom task to create a BOM
and manually include/exclude/customize dependencies. It would also use
the "maven" plugin to customize the POM before publication.

This commit now uses a Gradle Java Platform for publishing the Spring
Framework BOM. We're also now using the "maven-publish" plugin to
prepare and customize publications.

This commit also tells the artifactory plugin (which is currently
applied only on the CI) not to publish internal modules.

See gh-23282
2019-08-21 15:39:51 +02:00
Brian Clozel e45a3f4738 Rename non-Framework project modules
Prior to this commit, the Spring Framework build would mix proper
framework modules (spring-* modules published to maven central) and
internal modules such as:
* "spring-framework-bom" (which publishes the Framework BOM with all
modules)
* "spring-core-coroutines" which is an internal modules for Kotlin
compilation only

This commit renames these modules so that they don't start with
"spring-*"; we're also moving the "kotlin-coroutines" module under
"spring-core", since it's merged in the resulting JAR.

See gh-23282
2019-08-21 14:32:25 +02:00
Brian Clozel e9523161f0 Revert "Revert "Refactor Gradle tasks in Spring Framework build""
This reverts commit fb0d618751.
2019-08-20 20:26:43 +02:00
Stephane Nicoll fb0d618751 Revert "Refactor Gradle tasks in Spring Framework build"
This reverts commit 1539ba8991.
2019-08-20 20:07:11 +02:00
Brian Clozel 1539ba8991 Refactor Gradle tasks in Spring Framework build
This commit reorganizes tasks and scripts in the build to only apply
them where they're needed. We're considering here 3 "types" of projects
in our build:
* the root project, handling documentation, publishing, etc
* framework modules (a project that's published as a spring artifact)
* internal modules, such as the BOM, our coroutines support and our
integration-tests

With this change, we're strealining the project configuration for all
spring modules and only applying plugins when needed (typically our
kotlin support).

See gh-23282
2019-08-20 18:17:02 +02:00
Sam Brannen aa6e762dcf Re-enable shadowed, overridden @Test methods
Due to a bug (or "unintentional feature") in JUnit 4, overridden test
methods not annotated with @Test are still executed as test methods;
however, JUnit Jupiter does not support that. Thus, prior to this
commit, some overridden test methods in spring-core were no longer
executed after the migration from JUnit 4 to JUnit Jupiter.

This commit addresses this issue for such known use cases, but there
are likely other such use cases within Spring's test suite.

See gh-23451
2019-08-20 15:30:32 +02:00
Sam Brannen fab96cad67 Use default visibility for test classes and methods in spring-core
See gh-23451
2019-08-20 15:30:24 +02:00
Sam Brannen 4386bf05de Delete obsolete interface 2019-08-19 15:35:02 +02:00
Sam Brannen 74ccfe3533 Polish Spring's internal TestGroup support 2019-08-19 15:21:16 +02:00
Sebastien Deleuze 4d10249b70 Update to Coroutine 1.3.0-RC2
This updates brings full interoperability between Reactor and
Coroutines contexts.

Closes gh-22986
2019-08-19 10:03:01 +02:00
Andrey Kolchanov 6937d95e69 Remove unnecessary semicolon in AnnotatedElementUtils
Closes gh-23477
2019-08-17 15:07:39 +02:00
Sam Brannen 288461a541 Introduce @EnabledForTestGroups in Spring's test suite
Closes gh-23476
2019-08-17 14:47:24 +02:00
Sam Brannen 979508a7f3 Remove JUnit 4 dependency from all modules except spring-test
This commit removes the JUnit 4 dependency from all modules except
spring-test which provides explicit JUnit 4 support.

This commit also includes the following.

- migration from JUnit 4 assertions to JUnit Jupiter assertions in all
  Kotlin tests
- migration from JUnit 4 assumptions in Spring's TestGroup support to
  JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException
- introduction of a new TestGroups utility class than can be used from
  existing JUnit 4 tests in the spring-test module in order to perform
  assumptions using JUnit 4's Assume class

See gh-23451
2019-08-17 11:37:21 +02:00
Sam Brannen 3df85c783f Migrate parameterized tests in spring-core
This commit migrates parameterized tests in spring-core using the
"composed @ParameterizedTest" approach. This approach is reused in
follow-up commits for the migration of the remaining modules.

For a concrete example, see AbstractDataBufferAllocatingTests and its
subclasses (e.g., DataBufferTests).

Specifically, AbstractDataBufferAllocatingTests declares a custom
@ParameterizedDataBufferAllocatingTest annotation that is
meta-annotated with @ParameterizedTest and
@MethodSource("org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests#dataBufferFactories()").

Individual methods in concrete subclasses are then annotated with
@ParameterizedDataBufferAllocatingTest instead of @ParameterizedTest or
@Test.

The approach makes the migration from JUnit 4 to JUnit Jupiter rather
straightforward; however, there is one major downside. The arguments
for a @ParameterizedTest test method can only be accessed by the test
method itself. It is not possible to access them in an @BeforeEach
method (see https://github.com/junit-team/junit5/issues/944).
Consequently, we are forced to declare the parameters in each such
method and delegate to a custom "setup" method. Although this is a bit
cumbersome, I feel it is currently the best way to achieve fine grained
parameterized tests within our test suite without implementing a custom
TestTemplateInvocationContextProvider for each specific use case.

Once https://github.com/junit-team/junit5/issues/878 is resolved, we
should consider migrating to parameterized test classes.

See gh-23451
2019-08-17 11:36:47 +02:00
Sam Brannen 32cc32f9a7 Migrate test suite from JUnit 4 to JUnit Jupiter
This first commit for this issue:

- allows JUnit Jupiter to be used for all tests
- adds a dependency on mockito-junit-jupiter
- migrates tests in spring-core to JUnit Jupiter, except parameterized
  tests

The following script was developed in order to semi-automate the
migration process.

https://github.com/sbrannen/junit-converters/blob/master/junit4ToJUnitJupiter.zsh

See gh-23451
2019-08-17 11:36:25 +02:00
Juergen Hoeller 9bd3a535cd Avoid UndeclaredThrowableStrategy with 1.8 bytecode level (CGLIB 3.3)
ClassLoaderAwareUndeclaredThrowableStrategy fails with a VerifyError on recent JDKs after the CGLIB 3.3 upgrade. The alternative is to replace it with a plain ClassLoaderAwareGeneratorStrategy (extracted from CglibSubclassingInstantiationStrategy) and custom UndeclaredThrowableException handling in CglibMethodInvocation.

See gh-23453
2019-08-14 00:14:14 +02:00
Juergen Hoeller 4123910d3d Upgrade to CGLIB 3.3
Closes gh-23453
2019-08-12 19:36:06 +02:00
Sam Brannen fcbca7d569 Remove obsolete references to JUnit 4's ArrayComparisonFailure
See gh-23451
2019-08-12 12:45:14 +02:00
Sam Brannen 6c0e550b86 Polish contribution
See gh-23445
2019-08-10 14:07:15 +02:00
zhuzhuman978 849bbf00b5 Simplify if statements and replace try-finally with try-with-resources
Closes gh-23445
2019-08-10 14:03:18 +02:00
Sam Brannen 56c1e8ffd2 Polishing 2019-08-09 11:08:30 +02:00
Sam Brannen a532afb15d Use System.nanoTime() in StopWatch
Prior to this commit, StopWatch used System.currentTimeMillis() to
track and report running time in milliseconds.

This commit updates the internals of StopWatch to use System.nanoTime()
instead of System.currentTimeMillis(). Consequently, running time is
now tracked and reported in nanoseconds; however, users still have the
option to retrieve running time in milliseconds or seconds.

Closes gh-23235
2019-08-07 17:39:42 +02:00
Sam Brannen 24f8d30935 Remove deprecated MergedAnnotations.SearchStrategy.EXHAUSTIVE constant
Closes gh-23391
2019-08-07 12:34:17 +02:00
Sam Brannen a43ba052e9 Remove unnecessary loop in SerializableTypeWrapper
Since arbitrary levels of proxies do not occur, this commit replaces
the `while` loop in SerializableTypeWrapper.unwrap() with a simple
`if` statement.

Closes gh-23415
2019-08-07 12:24:48 +02:00
Sam Brannen 83956f8e8b Overhaul StopWatchTests 2019-08-07 12:13:18 +02:00
Sam Brannen 03dd45fbd6 Use AssertJ in AnnotationAttributesTests 2019-08-06 18:18:16 +02:00
Sam Brannen 34767b14da Merge branch '5.1.x' 2019-08-06 18:11:47 +02:00
Sam Brannen 30ebc3b8e2 Remove superfluous AnnotationAttributes#putIfAbsent implementation
Since Java 8, putIfAbsent() is a standard method in java.util.Map. We
therefore no longer need the custom implementation that overrides the
standard implementation in HashMap.
2019-08-06 18:10:13 +02:00
Sam Brannen a092dc055e Check for instanceof Throwable in AnnotationAttributes#assertNotException
Prior to this commit, AnnotationAttributes#assertNotException checked if
the attribute value was an instance of Exception. Although this was
typically sufficient, the scope was not always broad enough -- for
example, if AnnotationReadingVisitorUtils#convertClassValues stored a
Throwable in the map (such as a LinkageError).

This commit fixes this by checking for an instance of Throwable in
AnnotationAttributes#assertNotException.

Closes gh-23424
2019-08-06 18:06:00 +02:00
Sam Brannen 4d6e359e25 Add missing @deprecated tags for ASM-based annotation search classes 2019-08-05 15:30:06 +02:00
Sam Brannen 82f301f42f Polishing 2019-08-05 15:29:04 +02:00
Sam Brannen e6ab6c9fe9 Add missing @deprecated tag for AnnotationMetadataReadingVisitor 2019-08-05 14:39:20 +02:00
Sam Brannen c2f5dabeee Polishing 2019-08-03 00:13:30 +02:00
Sam Brannen 9be327985b Polishing 2019-08-01 23:15:40 +02:00
Sam Brannen ee2041388b Fix typo in Javadoc for MergedAnnotations 2019-08-01 23:15:39 +02:00
Juergen Hoeller aebc485eda MethodParameter.equals properly checks overridden containing class
Closes gh-23352
2019-08-01 14:34:39 +02:00
Juergen Hoeller b67dbe66ef Revise use of ResolvableType in MethodParameter
Includes consistent use of getContainingClass()
2019-08-01 14:25:26 +02:00
Juergen Hoeller 4612544505 Nullability refinements and related polishing 2019-08-01 13:04:46 +02:00
Phillip Webb 1e830f725c Polish firstRunOf javadoc 2019-08-01 08:29:02 +01:00
Phillip Webb 62a3e41473 Deprecate mutable methods of MethodParameter
Deprecate all mutation methods in `MethodParameter` in favor of factory
methods that return a new instance. Existing code that previously relied
on mutation has been updated to use the replacement methods.

Closes gh-23385
2019-08-01 08:05:14 +01:00
Sam Brannen de3c115614 Fix bug in TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy
Prior to this commit, the new `TYPE_HIERARCHY_AND_ENCLOSING_CLASSES`
annotation search strategy failed to find annotations on enclosing
classes if the source class was a nested class that itself had no
annotations present.

This commit fixes this by adding special logic to AnnotationsScanner's
isWithoutHierarchy() method to properly support nested classes.

Closes gh-23378
2019-07-31 22:05:46 +02:00
Sam Brannen b03dd47598 Remove duplicate assertion 2019-07-31 22:01:18 +02:00
Phillip Webb 17518ecbbe Add TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy
Add a `TYPE_HIERARCHY_AND_ENCLOSING_CLASSES` annotation search strategy
that can be used to search the full type hierarchy as well as any
enclosing classes.

Closes gh-23378
2019-07-31 14:40:40 +01:00
Phillip Webb a6021cc968 Rename SearchStrategy.EXHAUSTIVE to TYPE_HIERARCHY
Rename `SearchStrategy.EXHAUSTIVE` from `MergedAnnotations` to
`SearchStrategy.TYPE_HIERARCHY`

See gh-23378
2019-07-31 13:52:53 +01:00
Juergen Hoeller e6f86c5c75 Nullability refinements and related polishing 2019-07-31 13:45:48 +02:00
Phillip Webb cca32a56a4 Use shared zero length array constants
Update code that's often called so that zero length array results use
a single shared static constant, rather than a new instance for each
call.

Closes gh-23340
2019-07-31 12:22:03 +02:00
Juergen Hoeller 4f3b89e907 Adapt MethodParameterTests to AssertJ usage on master
See gh-23352
2019-07-30 17:36:02 +02:00
Juergen Hoeller 8ef557df2f Merge branch '5.1.x' 2019-07-30 17:34:29 +02:00
Juergen Hoeller 9a36027ae1 MethodParameter.equals checks nesting level and containing class
Closes gh-23352
2019-07-30 16:58:45 +02:00
Johnny Lim bccc7a62f4 Remove duplicate assertion in matchWithNullPath()
See gh-23382
2019-07-30 09:37:50 +02:00
Sam Brannen a3c7ae2c58 Polish contribution
See gh-23300
2019-07-24 10:13:29 +02:00
stsypanov 1d6e44ab04 Use StringJoiner where possible to simplify String joining
Closes gh-23300
2019-07-24 10:05:38 +02:00
Sebastien Deleuze c006a83584 Upgrade to Coroutines 1.3.0-RC
This commit upgrades Coroutines support to kotlinx.coroutines
1.3.0-RC, leverages the new Coroutines BOM and refine Coroutines
detection to avoid false positives.

Only Coroutines to Mono context interoperability is supported
for now.

CLoses gh-23326
2019-07-21 11:27:43 +02:00
Juergen Hoeller 45136aabd4 Upgrade to Protobuf 3.9 (plus consistent XMLUnit declarations) 2019-07-20 19:06:54 +02:00
Juergen Hoeller 8ea3aa512f Merge branch '5.1.x' 2019-07-20 16:35:05 +02:00
Juergen Hoeller 209c8505e6 Align forRawClassAssignableFromTypeVariable with 5.1 assertion style
See gh-23321
2019-07-20 16:10:49 +02:00
Juergen Hoeller 69d3e89814 Polishing 2019-07-20 15:05:49 +02:00
Phillip Webb be65bef91b Merge branch '5.1.x' 2019-07-20 13:23:37 +01:00
Phillip Webb e5bef10d85 Fix ResolvableType raw class isAssignable checks
Fix `isAssignable` for `ResolvableType.forRawClass` so that it can be
used with types backed by a `TypeVarible`. Prior to this commit the
rawClass value was used, which wouldn't always work.

Closes gh-23321
2019-07-20 13:23:21 +01:00
Arjen Poutsma 090bfa63a1 Add DataBuffer::toString(Charset)
Closes gh-23317
2019-07-19 12:45:24 +02:00
Arjen Poutsma c8704ce473 Introduce DataBufferWrapper
This commit introduces the DataBufferWrapper, a wrapper for DataBuffers,
and uses it in applicable use cases.
2019-07-19 12:45:24 +02:00
Sebastien Deleuze 095fd5bcb3 Use Kotlin BOM
Close gh-23316
2019-07-19 10:43:54 +02:00
Juergen Hoeller 7f33344784 Tracking ASM master
See gh-23156
2019-07-17 22:34:39 +02:00
Juergen Hoeller 94e3210ae7 Fix nullability warnings and javadoc-triggered package cycles 2019-07-17 22:34:07 +02:00
Sam Brannen 7779aa3487 Polish contribution
See gh-23297
2019-07-17 16:53:47 +02:00
Scheidter,Ryan 84200f3141 Treat null path as non-matching pattern in AntPathMatcher
Prior to this commit, a null path supplied to the isPattern(), match(),
and matchStart() methods in AntPathMatcher resulted in a
NullPointerException.

This commit addresses this by treating a `null` path as a non-matching
pattern.

Closes gh-23297
2019-07-17 16:53:47 +02:00
Sam Brannen 699d3f15e8 Simplify LocalVariableTableParameterNameDiscoverer implementation
This commit refactors the internals of
LocalVariableTableParameterNameDiscoverer to use
java.lang.reflect.Executable in order to simplify the implementation.
2019-07-12 12:02:49 +02:00
mfeng-ya 309b328719 Use computeIfAbsent in LocalVariableTableParameterNameDiscoverer
Closes gh-23281
2019-07-12 11:44:10 +02:00
Arjen Poutsma 09572e7b60 Removed DataBufferUtils::split
DataBuffers::split (and underlying algorithm) should not be returning
a Flux<DataBuffer>, but rather a Flux<Flux<DataBuffer>>. In other words,
it should not join all data buffers that come before a delimiter.

Providing an implementation of a such a fully reactive split method
proved to be beyond the scope of this release, so this commit removes
the method altogether.
2019-07-10 16:00:11 +02:00
Arjen Poutsma fdcf09dc2f Copied buffering split from DataBufferUtils to StringDecoder
Due to the imminent removal of DataBufferUtils.split, this commit copies
over the buffering split algortihm from DataBufferUtils, as it is still
sutable for the StringDecoder
2019-07-10 16:00:11 +02:00
Arjen Poutsma ef19a6bf8e Various DataBufferUtils improvements
- Made sure that takeUntilByteCount is usable in multiple subscriptions.
- Added composite Matcher
2019-07-10 16:00:11 +02:00
Sebastien Deleuze ca75c2843a Upgrade to Coroutines 1.3.0-M2 2019-07-09 11:36:26 +02:00
Rossen Stoyanchev c199cb9054 @ConnectMapping for RSocket handling
The new annotation helps to differentiate the handling of connection
level frames (SETUP and METADATA_PUSH) from the 4 stream requests.

Closes gh-23177
2019-07-08 17:04:23 +01:00
Sam Brannen fae75cb238 Polish contribution
See gh-23237
2019-07-07 16:29:03 +02:00
Сергей Цыпанов 9f81ffa5ae Use StringJoiner where possible to simplify String joining
Closes gh-23237
2019-07-07 16:19:01 +02:00
Sam Brannen 8f5b2b2231 Merge branch '5.1.x' 2019-07-07 14:49:34 +02:00
Sam Brannen efab6eb55d Ignore empty entries when parsing MediaTypes and MimeTypes
Prior to Spring Framework 5.1.3, MimeTypeUtils.parseMimeTypes() and
MediaType.parseMediaTypes() ignored empty entries, but 5.1.3 introduced
a regression in that an empty entry -- for example, due to a trailing
comma in the list of media types in an HTTP Accept header -- would result
in a "406 Not Acceptable" response status.

This commit fixes this by filtering out empty entries before parsing
them into MimeType and MediaType instances. Empty entries are therefore
effectively ignored.

Fixes gh-23241
2019-07-07 12:39:46 +02:00
Juergen Hoeller d903b9acf5 Compatibility with RxJava 3.0
Closes gh-23208
2019-07-05 16:25:52 +02:00
Juergen Hoeller 6990504d17 Upgrade to ASM 7.2
Closes gh-23156
2019-07-05 16:24:45 +02:00
Rossen Stoyanchev 0d3e5db3ff Compare suffix patterns by length
Closes gh-23125
2019-07-05 07:36:35 +01:00
Phillip Webb b3d56ebf3b Restore StringUtils.hasLength check
Update `MimeTypeUtils` so that the  StringUtils.hasLength check is
performed immediately on the incoming argument, rather than in
`parseMimeTypeInternal`. This restores the `IllegalArgumentException`
rather than the `NullPointerException` which is thrown by the
`ConcurrentHashMap`.

Closes gh-23215
See gh-23211
2019-06-29 22:31:11 -07:00
Brian Clozel 5a308ad5bd Polish MimeTypeUtils LRU cache
This commit improves the cache implementation by skipping the ordering
of most recently used cached keys when the cache is at least half empty.

See gh-23211
2019-06-29 00:17:40 +02:00
Brian Clozel 1b93ea97ac Fix concurrent reads issue in MimeTypeUtils cache
As of gh-22340, `MimeTypeUtils` has a built-in LRU cache implementation
for caching parsed MIME types and avoiding excessive garbage creation at
runtime.
This implementation, when hit with highly concurrent reads on the same
media type (the cache key), can create multiple keys for the same MIME
type string. This duplication leads to the cache filling up and evicting
entries. When the cache fetches a duplicate key, it is then not
associated with a value and the cache can return a `null` value, which
is forbidden by the API contract.

This commit adds another cache check within the write lock: this avoids
creating duplicate entries in the cache and `null` return values.

Fixes gh-23211
2019-06-28 23:43:38 +02:00
Sam Brannen 33fa55e658 Update OrderComparatorTests based on clarified PriorityOrdered semantics
See gh-23187
2019-06-25 11:04:19 +03:00
Sam Brannen b2dc4debde Merge branch '5.1.x' 2019-06-25 10:42:14 +03:00
Sam Brannen dda4dfb44b Clarify semantics of the PriorityOrdered interface
This commit clarifies the semantics of the PriorityOrdered interface
with respect to sorting sets of objects containing both PriorityOrdered
and plain Ordered objects.

Closes gh-23187
2019-06-25 10:40:55 +03:00
Johnny Lim 1afc2be5aa Remove duplicate assertion in AnnotatedElementUtilsTests
Closes gh-23191
2019-06-25 10:00:12 +03:00
Sam Brannen 6cc6abd405 Test status quo for OrderComparator's PriorityOrdered support
See gh-23187
2019-06-24 14:13:46 +03:00
Sam Brannen 4357749a63 Document that OrderComparator honors PriorityOrdered
Prior to this commit, it was not clear that OrderComparator sorts
PriorityOrdered objects with higher priority than plain Ordered objects.
2019-06-24 13:32:54 +03:00
Sam Brannen e3b3481c19 Fix typo in Javadoc 2019-06-24 12:32:41 +03:00
Sam Brannen 4000b244ff Forbid null converters in RestTemplate & HttpMessageConverterExtractor
Prior to this commit, RestTemplate and HttpMessageConverterExtractor did
not validate that the supplied HttpMessageConverter list contained no
null elements, which can lead to a NullPointerException when the
converters are accessed.

This commit improves the user experience by failing immediately if the
supplied HttpMessageConverter list contains a null element. This applies
to constructors for RestTemplate and HttpMessageConverterExtractor as
well as to RestTemplate#setMessageConverters().

Note, however, that RestTemplate#getMessageConverters() returns a mutable
list. Thus, if a user modifies that list so that it contains null values,
that will still lead to a NullPointerException when the converters are
accessed.

This commit also introduces noNullElements() variants for collections in
org.springframework.util.Assert.

Closes gh-23151
2019-06-18 16:13:20 +03:00
Sam Brannen f6a4595cef Polishing 2019-06-17 17:06:37 +03:00
Arjen Poutsma f08656c6cb Add methods to read/write from Path to DataBufferUtils
This commit adds two methods to DataBufferUtils:
- one that reads a Flux<DataBuffer> from a Path
- one that writes a Flux<DataBuffer> to a Path
2019-06-14 14:13:18 +02:00
Juergen Hoeller 0a77477d32 Merge branch '5.1.x' 2019-06-12 18:16:30 +02:00
Juergen Hoeller fc46abf0b7 Polishing 2019-06-12 18:04:06 +02:00
Juergen Hoeller 1ccd99ebe7 Polishing 2019-06-12 14:11:39 +02:00
Juergen Hoeller 918ffacdf8 Polishing 2019-06-12 13:29:35 +02:00
Sam Brannen bee4fb0615 Polishing 2019-06-12 14:07:04 +03:00