Commit Graph

16793 Commits

Author SHA1 Message Date
Juergen Hoeller
3d7e373e5a Polishing
(cherry picked from commit 77ab88b144)
2018-11-23 19:12:30 +01:00
Sam Brannen
f0e69e06b7 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

(cherry-picked from commit 81fde5ec41)
2018-11-23 17:38:42 +01:00
Sam Brannen
cd67b285e1 Ensure that parameter resolution in SpringExtension is thread-safe
Prior to this commit, parallel execution of @BeforeEach and @AfterEach
methods that accepted @Autowired arguments would fail intermittently
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 creating instances of
SynthesizingMethodParameter via
SynthesizingMethodParameter.forExecutable(Executable, int) instead of
SynthesizingMethodParameter.forParameter(Parameter), since the latter
looks up the parameter index by iterating over the array returned by
Executable.getParameters() (which is not thread-safe).

Issue: SPR-17533
2018-11-23 17:00:38 +01:00
Juergen Hoeller
39925c334d Polishing 2018-11-22 20:38:26 +01:00
Juergen Hoeller
2e55486cc3 Upgrade to Reactor Bismuth SR14, Tomcat 8.5.35, Jetty 9.4.14 2018-11-22 17:45:16 +01:00
Juergen Hoeller
e2b74e6943 Polishing 2018-11-22 17:44:29 +01:00
Juergen Hoeller
5382260f30 Client/ServerRequest defensively accesses internal attribute map
Issue: SPR-17486
2018-11-22 17:43:53 +01:00
Juergen Hoeller
35da9f1ddf FastByteArrayOutputStream.read byte-to-int conversion
Issue: SPR-17492
2018-11-22 17:43:31 +01:00
Juergen Hoeller
e6c979606c Nullability fine-tuning based on IntelliJ IDEA 2018.3 inspection
Issue: SPR-15540

(cherry picked from commit bf272b0b21)
2018-11-22 17:43:13 +01:00
Juergen Hoeller
23d1049363 CachingMetadataReaderFactory releases shared cache Map on clearCache()
LocalResourceCache properly initializes cacheLimit on construction.

Issue: SPR-17527

(cherry picked from commit 262c702da4)
2018-11-22 17:42:27 +01:00
Juergen Hoeller
37a50d701e SerializedBeanFactoryReference falls back to dummy with specific id
Issue: SPR-17508

(cherry picked from commit f5aeb81473)
2018-11-22 17:42:06 +01:00
Rossen Stoyanchev
567fcc41cc ForwardedHeaderTransformer handles encoding correctly
Issue: SPR-17525
2018-11-21 11:17:10 -05:00
Rossen Stoyanchev
97dac8a45d Update @since version after backport 2018-11-21 09:36:34 -05:00
Rossen Stoyanchev
736b3c45e8 BEST_MATCHING_HANDLER_ATTRIBUTE for spring-webmvc
Issue: SPR-17518
2018-11-21 09:24:35 -05:00
Brian Clozel
617b94afb6 Polish
See SPR-17502
2018-11-20 18:03:07 +01:00
Brian Clozel
5342c6e493 Remove Content-Length response header from errors
Prior to this commit, when errors happened before the response was
committed, the `Content-Length` response header would be left as is.
This can be problematic since the error can be handled later in the
chain and the response body changed accordingly. For example, Spring
Boot renders error pages in those cases. If the `Content-Length` is set,
HTTP clients can get confused and only consider part of the error
response body.

This commit ensures that any `Content-Length` response header is removed
in case of errors, if the response is not already committed.

This is done at the `AbstractServerHttpResponse` level, since errors can
be handled in multiple places and the response itself is the safest
place to handle this case.

As a consequence, this commit also removes `Content-Length` checks in
`EncoderHttpMessageWriter` since we now consider that we should rely on
the response body we're about to write rather than any previously set
value.

Issue: SPR-17502
(Cherry-picked from 3203d39821)
2018-11-19 16:06:32 +01:00
Rossen Stoyanchev
18da718bf5 Enforce use of unpooled data buffers in 5.0.x
Issue: SPR-17501
2018-11-16 11:26:54 -05:00
Rossen Stoyanchev
24051619a5 Consistent encoding in DefaultUriBuilderFactory
Unlike 5,1, TEMPLATE_AND_VALUES is not the default encoding mode.
Nevertheless when that mode is used, it should work consistently.

Issue: SPR-17465
2018-11-09 14:50:39 -05:00
Rossen Stoyanchev
f73a5222f1 Ensure client response is drained with onStatus hook
Issue: SPR-17473
2018-11-08 22:33:37 -05:00
Juergen Hoeller
8a2262e210 Up-to-date version and link in ASM/CGLIB/Objenesis package javadoc
Issue: SPR-14514
Issue: SPR-15600
2018-11-08 17:06:54 +01:00
Juergen Hoeller
0167b79d7b Consistently return empty array in case of empty batch arguments
Issue: SPR-17476

(cherry picked from commit 362c59c310)
2018-11-08 13:57:42 +01:00
Juergen Hoeller
b462ca22a5 Upgrade to Reactor Bismuth SR13 (and Netty 4.1.31)
Issue: SPR-17306
2018-11-05 22:42:42 +01:00
Juergen Hoeller
4bd95663f9 Polishing
(cherry picked from commit 5e7a8b275d)
2018-11-05 22:42:27 +01:00
Juergen Hoeller
561511f66c Explicit notes on class/method-level semantics in class hierarchies
Issue: SPR-17445

(cherry picked from commit ea3250c8d6)
2018-11-05 22:33:20 +01:00
Juergen Hoeller
88f4e9205a Synchronized onRefresh execution for concurrent ContextRefreshedEvent
Issue: SPR-17442

(cherry picked from commit b1f5f51503)
2018-11-05 22:32:47 +01:00
Juergen Hoeller
591e7f1f72 StandardEvaluationContext supports concurrent variable modification
Issue: SPR-17448

(cherry picked from commit 59fa647e2d)
2018-11-05 22:32:21 +01:00
Juergen Hoeller
c834790135 Deprecate ReflectionUtils.invokeJdbcMethod (for removal in 5.2)
Includes deprecation of NON_BRIDGED_METHODS constant.

Issue: SPR-17464

(cherry picked from commit 0a7dcf14f9)
2018-11-05 22:32:04 +01:00
Rossen Stoyanchev
9b4f48309a Fix formatting on index.adoc 2018-11-05 13:16:27 -05:00
Rossen Stoyanchev
8013566d99 Feature Github Wiki more prominently
Issue: SPR-17469
2018-11-05 13:13:39 -05:00
Rossen Stoyanchev
3bb11a0123 Fix failing test
After the fix #658c7f for lenient parsing of dates, the error message
raised uses an HttpHeaders-formatted date. As a result the test
verifying the error message fails in the beginning of the month between
1-9 because it's formatted slightly differently.
2018-11-01 15:46:28 -04:00
Juergen Hoeller
e28a995ab7 Consistent check for Void.class in DefaultClientResponse
Issue: SPR-16636
2018-10-27 15:19:55 +02:00
Juergen Hoeller
c10a8bb3b8 Exclude FactoryBean implementation methods on CGLIB proxies as well
Issue: SPR-17374

(cherry picked from commit dc1e3b4628)
2018-10-27 15:19:12 +02:00
Brian Clozel
2d14bd7066 Configure ResourceUrlProvider in WebFlux
Prior to this commit, no `ResourceUrlProvider` was configured
in WebFlux (no bean was contributed by the WebFlux infrastructure).
Also, several `ResourceTransformer` instances that extend the
`ResourceTransformerSupport` base class need a `ResourceUrlProvider`
to resolve absolute URLs when rewriting resource URLs. At this point,
no `ResourceUrlProvider` was configured and they could only resolve
relative URLs.

This commit contributes a new `ResourceUrlProvider` to the WebFlux
configuration; this bean can be reused by the WebFlux infrastructure and
application code.

This also automatically configure this shared `ResourceUrlProvider`
instance on the resource chain where needed.

Issue: SPR-17433
(Cherry-picked from fc957e95bb)
2018-10-26 14:35:01 +02:00
Juergen Hoeller
2acfb2e0ff Polishing 2018-10-26 11:23:42 +02:00
Juergen Hoeller
3ceb05f63c Upgrade to Jackson 2.9.7, Netty 4.1.30, Tomcat 8.5.34, Undertow 1.4.26
Also includes Apache Johnzon 1.1.10 and JRuby 9.1.17.
2018-10-25 17:39:47 +02:00
Juergen Hoeller
9e2d024d8d Asciidoc revision (minor backport for addressing build-time warnings) 2018-10-25 17:39:47 +02:00
Brian Clozel
3b7c0fc1a1 Fix absolute paths when transforming resources
Prior to this commit, `ResourceTransformerSupport.toAbsolutePath`
would call `StringUtils.applyRelativePath` in all cases. But this
implementation is prepending the given path even if the relative path
starts with `"/"`.

This commit skips the entire operation if the given path is absolute,
i.e. it starts with `"/"`.

Issue: SPR-17432
(Cherry-picked from 2146e13787)
2018-10-25 17:35:26 +02:00
Juergen Hoeller
d5f725d503 Polishing
(cherry picked from commit ffa032e78f)
2018-10-24 21:24:42 +02:00
Juergen Hoeller
c9f1016581 ConfigurableWebApplicationContext needed for contextClass parameter
Issue: SPR-17414

(cherry picked from commit 1c67ef4bed)
2018-10-24 21:24:42 +02:00
Juergen Hoeller
110796375b SpringFactoriesLoader tolerates whitespace around class names
Issue: SPR-17413

(cherry picked from commit dd2ce20687)
2018-10-24 21:24:42 +02:00
Juergen Hoeller
b87ce596a0 Avoid stacktrace if root resource is not resolvable in file system
Issue: SPR-17417

(cherry picked from commit 83a54dba7e)
2018-10-24 21:24:42 +02:00
Juergen Hoeller
5a6c081cfe Clarify FactoryBean initialization effect in getBeanNamesForAnnotation
Issue: SPR-17392

(cherry picked from commit da23505e94)
2018-10-24 21:24:42 +02:00
Juergen Hoeller
c73b98cf33 Clarify destruction order effect in @DependsOn annotation javadoc
Issue: SPR-17384

(cherry picked from commit 00b7782b5f)
2018-10-24 21:24:42 +02:00
Brian Clozel
cf25efc7d3 Fix ResourceUrlEncodingFilter lifecycle
Prior to this commit, the `ResourceUrlEncodingFilter` would wrap the
response and keep a reference to the request. When
`HttpServletResponse.encodeURL` is later called during view rendering,
the filter looks at the request and extracts context mapping information
in order to resolve resource paths in views.

This approach is flawed, when the filter is used with JSPs - if the
request is forwarded to the container by the `InternalResourceView`,
the request information is overwritten by the container. When the view
is being rendered, the information available in the request is outdated
and does not allow to correctly compute that context mapping
information.

This commit ensures that that information is being extracted from the
request as soon as the `ResourceUrlProvider` is set as a request
attribute.

Issue: SPR-17421
(Cherry-picked from 50a4769162)
2018-10-24 21:19:33 +02:00
Rossen Stoyanchev
36510cf808 Server adapters release buffers on error/cancel
Review and update Servlet and Undertow adapters to release any data
buffers they be holding on to at the time of error or cancellation.

Also remove onDiscard hooks from Reactor and Undertow request body.
For Reactor we expect it to be handled. For Undertow there isn't
any Reactor Core upstream for the callback to be useful.

Issue: SPR-17410
2018-10-23 20:56:08 -04:00
Rossen Stoyanchev
d492d7b6a4 Update ref docs on ResponseEntity and reactive types
Issue: SPR-17400
2018-10-23 17:06:02 -04:00
Rossen Stoyanchev
bf4d00cb62 Upgrade to Reactor Bismuth snapshots
Towards SR13 to confirm fix for SPR-17306.
2018-10-23 15:49:09 -04:00
Rossen Stoyanchev
6ea3441adf Restore log level for resolved exceptions
The fix for SPR-17178 switched from debug to warn level warning for
all sub-classes of AbstractHandlerExceptionResolver where the request
concerned the DefaultHandlerExceptionResolver only.

This commit restores the original DEBUG level logging that was in
AbstractHandlerExceptionResolver from before SPR-17178. In addition
DefaultHandlerExceptionResolver registers a warnLogCategory by default
which enables warn logging and hence fulfilling the original goal
for SPR-17178.

Issue: SPR-17383
2018-10-22 12:18:33 -04:00
Sebastien Deleuze
73db2081cd Leverage Java reflection for Kotlin enums
As discussed in KT-25165, from a Kotlin POV enum constructors
have no parameter, this is an "implementation detail"
required for running on the JVM, so it seems relevant to skip
Kotlin reflection in that case and just delegate to Java
reflection.

Issue: SPR-16931
2018-10-16 16:42:31 +02:00
Spring Buildmaster
38490f13b1 Next Development Version 2018-10-15 08:01:59 +00:00