Commit Graph

1660 Commits

Author SHA1 Message Date
Brian Clozel 05d7ab4328 Merge branch '5.1.x' 2019-02-06 20:00:02 +01:00
Brian Clozel ef8652615c Log exception at ERROR level in CompositeLog
Fixes gh-22364
2019-02-06 19:58:41 +01:00
Juergen Hoeller 34ddb1e3cd Merge branch '5.1.x' 2019-02-05 16:32:58 +01:00
Juergen Hoeller 9895e44d73 Polishing 2019-02-05 16:03:24 +01:00
Juergen Hoeller 643a68f81b Detect existing jar URLs from URLClassLoader.getURLs()
Closes gh-22346
2019-02-05 16:02:50 +01:00
Sebastien Deleuze 0b9522c84e Migrate Kotlin Mockito tests to Mockk
Closes gh-22345
2019-02-05 15:47:08 +01:00
Juergen Hoeller 4c9ae6494f Concurrency/nullability fine-tuning in MimeType(Utils)
See gh-22340
2019-02-05 15:38:41 +01:00
Brian Clozel 1bf3b36ce8 Polish
See gh-22340
2019-02-05 15:06:33 +01:00
Brian Clozel ba8849dda3 Avoid MimeType garbage creation
Prior to this commit, calls to `MimeType` and `MediaType` would create a
significant amount of garbage:

* during startup time, in the static sections of `MimeType` and
`MediaType` when creating well-known types
* at runtime, when parsing media types for content negotiation or
writing known media types as strings in HTTP response headers

This commit does the following:

* Avoid parsing the well-known types and use regular constructors
instead
* Cache types in a simple LRU cache once they've been parsed, since an
application is likely to deal with a limited set of types
* Avoid using `java.util.stream.Stream` in hot code paths

Benchmarks show that a complete revision of the `MimeTypeUtils` parser
is not required, since the LRU cache is enough there.

Closes gh-22340
2019-02-05 14:33:43 +01:00
Brian Clozel 862fa557bd Avoid java.util.stream.Stream usage in hot paths
Prior to this commit, profiling sessions would show that using
`java.util.stream.Stream` in some hot code paths creates significant
garbage.

Where streams aren't really required, this commit turns those snippets
into imperative logic  because those are likely to be called once or
multiple times per request.

Closes gh-22341
2019-02-05 12:14:51 +01:00
Juergen Hoeller d27bae245a Polishing 2019-02-05 00:45:28 +01:00
Juergen Hoeller a27a6470f7 Polishing 2019-02-05 00:10:22 +01:00
stsypanov 248d3f8e8b Use AtomicInteger instead of unsafe increment on volatile fields 2019-02-04 23:22:20 +01:00
Juergen Hoeller 80385ced4c Remove java.sql dependency from ReflectionUtils/TransactionDefinition
Fixes gh-21996
2019-01-28 22:50:11 +01:00
Arjen Poutsma 4732f83d70 Fix Java 9 Build
Fix Java 9 build by replacing deprecated method.
2019-01-24 15:44:58 +01:00
Brian Clozel 2b65d0e51f Fix error when writing empty String to DataBuffer
Prior to this commit, `DataBuffer.write` would throw an
`IllegalStateException` when called with an empty `String`, since the
`CharsetEncoder` would be flushed on an incorrent state.

This commit skips entirely the encoding phase for empty `String`.

Fixes #22262
2019-01-17 11:09:48 -05:00
Juergen Hoeller 72dddfbc7b Polishing 2019-01-09 12:26:58 +01:00
Andrzej Leśkiewicz 952045c216 SPR-17606 @Profile mishandles "not" operand mixed with "&" (#2066)
Correct handling of not/and expressions in ProfilesParser

Issue: SPR-17606
2019-01-08 22:24:15 +01:00
Juergen Hoeller f56fa91430 Polishing 2019-01-08 17:11:34 +01:00
Juergen Hoeller 9cb5369cb9 DependencyDescriptor supports TypeDescriptor resolution for fields
This allows for proper nested type conversion in @Value Optional fields analogous to method parameters, through a new TypeDescriptor-based method in the TypeConverter SPI. As an additional and less involved measure that is worth backporting, DefaultListableBeanFactory defensively checks for pre-converted Optional wrappers.

Issue: SPR-17607
2019-01-08 17:11:27 +01:00
Rossen Stoyanchev 673a20cb10 Defensive initialization of AsyncXMLInputFactory
Aalto's InputFactoryImpl already disables loading of external entities
by default (property "javax.xml.stream.isSupportingExternalEntities").
This commit goes further by applying the same defensive measures as we
do elsewhere for XMLInputFactory, which disables DTD completely.
Arguably there is no good reason to enable that by default in WebFlux.
2019-01-07 13:52:46 -05:00
Rossen Stoyanchev 4b24bcb799 More accurate checks for presence of MediaType.ALL
Typically a straight up equals as well as Collections#contains
checks for MediaType.ALL is susceptible to the presence of
media type parameters.

This commits adds equalsTypeAndSubtype as well as an
isPresentIn(Collection<MimeType>) methods to MimeType to faciliate
with checks for MediaType.ALL.

Issue: SPR-17550
2019-01-02 14:32:50 -05:00
Sebastien Deleuze 78a6429c32 Document NumberUtils.parseNumber() trim behavior
Issue: SPR-9523
2018-12-28 09:58:25 +01:00
Juergen Hoeller 31a24720a6 Consistent support for EnumSet subclasses in CollectionFactory
Issue: SPR-17619
2018-12-25 13:20:31 +01:00
Arjen Poutsma 5a8b8b11e4 Add test for calculateCapacity
Issue: SPR-17558
Closes gh-2054
2018-12-20 21:34:15 +01:00
Arjen Poutsma a00be62b04 Calculating capacity before allocation.
This commit optimizes the `CharSequenceEncoder` to allocate `DataBuffer`
instances with a predicted capacity.

Issue: SPR-17558
2018-12-20 21:33:50 +01:00
Brian Clozel 4955d08f28 Use DataBuffer.write in CharSequenceEncoder
Since SPR-17558, `DataBuffer` now offers a new method to write Strings
to them. This commit makes `CharSequenceEncoder` use that.

Issue: SPR-17558
2018-12-20 21:33:44 +01:00
Brian Clozel 6361b0cb23 Write CharSequence instances to DataBuffers
Prior to this commit, one could write a `CharSequence` to an existing
`DataBuffer` instance by turning it into a byte array or `ByteBuffer`
first. This had the following disadvantages:

1. Memory allocation was not efficient (not leveraging pooled memory
when available)
2. Dealing with `CharsetEncoder` is not always easy
3. `DataBuffer` implementations, like `NettyDataBuffer` can use
optimized implementations in some cases

This commit adds a new `DataBuffer#write(CharSequence, Charset)` method
for those cases and also an `ensureCapacity` method useful for checking
that the current buffer has enough capacity to write to it..

Issue: SPR-17558
2018-12-20 21:33:33 +01:00
stsypanov 112cc70231 Improve performance of ConcurrentReferenceHashMap creation 2018-12-13 16:57:48 +01:00
igor-suhorukov 93189a6733 String.indexOf() expressions can be replaced with a call to the String.contains() method available in Java 5 and newer. 2018-12-13 12:29:31 +01:00
Juergen Hoeller c48672c4c7 ParameterNameDiscoverer may return individual null entries in an array
Issue: SPR-17565
2018-12-12 21:56:17 +01:00
Rossen Stoyanchev 38ae282c3b Update log category precision for all tests
Replace the full category capped at 36 chars with the class name only
and 1 char per package, e.g. org.apache.commons.Foo -> o.a.c.Foo
2018-12-12 11:40:33 -05:00
Juergen Hoeller 0ad35053fb Upgrade to CGLIB 3.2.10
Includes upgrade to JarJar 1.7.2 and Tomcat 9.0.14.

Issue: SPR-17595
2018-12-12 16:03:31 +01:00
Juergen Hoeller 6eb0a60df9 Polishing 2018-12-12 11:16:53 +01:00
Juergen Hoeller aaaf81ed99 Polishing 2018-12-06 15:53:57 +01:00
Juergen Hoeller 50e5bdb813 Clarified VfsResource constructor
Issue: SPR-17563
2018-12-04 22:09:06 +01:00
Juergen Hoeller 6d7827e36b Polishing 2018-12-03 23:53:00 +01:00
Juergen Hoeller d5dab12909 NettyDataBufferFactory.join returns single-element buffer as-is
Issue: SPR-17560
2018-12-03 23:52:35 +01:00
Sam Brannen a528407d0c Suppress warning 2018-11-23 18:05:47 +01:00
Sam Brannen 81fde5ec41 Ensure that MethodParameter.findParameterIndex() is thread-safe
Prior to this commit, parallel invocations of
MethodParameter.findParameterIndex() (invoked indirectly via
SynthesizingMethodParameter.forParameter() and
MethodParameter.forParameter()) could intermittently lead to an
IllegalArgumentException being thrown due to a race condition in the
internal implementation of the JDK's
java.lang.reflect.Executable.getParameters() method.

This commit addresses this issue by introducing a fallback for-loop
that iterates over the candidate parameters a second time using
equality checks instead of identity checks.

Issue: SPR-17534
2018-11-23 17:37:20 +01:00
Juergen Hoeller 56234fe877 Polishing 2018-11-22 22:03:36 +01:00
Juergen Hoeller 262c702da4 CachingMetadataReaderFactory releases shared cache Map on clearCache()
LocalResourceCache properly initializes cacheLimit on construction.

Issue: SPR-17527
2018-11-22 11:20:47 +01:00
Juergen Hoeller fef0e21d8b Remove unused LinkedList import 2018-11-20 22:16:51 +01:00
Juergen Hoeller 8c7579eba8 Polishing 2018-11-20 22:06:44 +01:00
stsypanov 02d3cfa42d Use ArrayList instead of LinkedList 2018-11-20 21:54:51 +01:00
Vojtech Janota 12f168290d SPR-17492: FastByteArrayOutputStream.read byte-to-int conversion 2018-11-20 17:08:01 +01:00
Arjen Poutsma 63275ae2b7 Add Test for LeakAwareDataBufferFactory 2018-11-19 16:56:25 +01:00
Juergen Hoeller ce5c65c0b0 Upgrade to JAXB 2.3.1, Groovy 2.5.4, Jetty 9.4.14, Tomcat 9.0.13
Includes JAX-WS 2.3.1, Awaitility 3.1.3, OkHttp 3.12, Woodstox 5.2.
2018-11-19 12:41:26 +01:00
Stephane Nicoll 7b6f2f8fb3 Polish contribution
Closes gh-2019
2018-11-19 08:45:33 +01:00
Hanope bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00