Move connection cleanup into a finally block so the connection
is closed even if commit or auto-commit restoration fails.
Closes gh-37321
Signed-off-by: cookie-meringue <daehyeon3351@gmail.com>
* `DefaultPersistenceUnitManager.java`
`dataSourceLookup` is initialized with a non-null `DataSourceLookup`, so `getDataSourceLookup()` does not return `null`.
* `TestContextTransactionUtils.java`
The transaction attribute name is stored as a non-null value, so `getName()` does not return `null`.
* `RequestContext.java`
The model is represented by a `Map` rather than a nullable value, so `getModel()` can return a non-null `Map`.
Closes gh-37379
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Prior to this commit, RenderingResponse.from() did not copy the
cookies of the given response, unlike ServerResponse.from().
See gh-22481
Closes gh-37378
Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>
Prior to this commit, CONTRIBUTING.md delegated build instructions
and code style to wiki pages, which are planned for removal.
This commit inlines the build, code style and testing guidelines
into CONTRIBUTING.md, aligns them with the current build and
Checkstyle rules, and documents the commit message conventions, the
security policy and the policy on AI-assisted contributions. It also
adds a concise AGENTS.md extract for coding agents, and updates the
README to link to the Build from Source section.
Closes gh-37372
Signed-off-by: Sébastien Deleuze <sdeleuze@users.noreply.github.com>
Before this commit, `second.remove(o)` was called no matter whether
`first.remove(o)` returned `true` or `false`. If the element was present
in both collections, it was removed from both, which violates the
`Collection.remove(Object)` contract of removing a single instance.
Closes gh-37332
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
Prior to this commit, JpaTransactionManager and
HibernateTransactionManager stated that they do not support "running
within DataSourceTransactionManager" when encountering a pre-bound
JDBC Connection that is not synchronized with a transaction.
However, DataSourceTransactionManager marks its ConnectionHolder as
synchronized with the transaction and therefore does not trigger this
check. Instead, the exception is typically caused by another
JpaTransactionManager or HibernateTransactionManager for a different
persistence unit exposing a JDBC Connection for the same DataSource,
or by a JDBC Connection that has been left bound to the current
thread.
This commit revises the exception message accordingly so that it no
longer points to DataSourceTransactionManager.
See gh-14130
Closes gh-37356
Signed-off-by: rene.schakmann <rene.schakmann@reetgroup.com>
Prior to this commit, the Javadoc for ConcurrentReferenceHashMap
stated that soft or weak references are used for both keys and values.
However, the references are applied to the internal map entries, each
of which holds strong references to its key and value. Consequently,
an entry may be discarded even if its key and value are still strongly
reachable from elsewhere, which differs from the semantics of
WeakHashMap.
This commit revises the class-level Javadoc as well as the Javadoc for
the ReferenceType constants to document this behavior.
See gh-24253
Closes gh-37357
Signed-off-by: rene.schakmann <rene.schakmann@reetgroup.com>
Prior to this commit, the reference manual mentioned that the JSP
<form:input> tag supports HTML5-specific types, but the Javadoc and
spring-form.tld did not document the `type` attribute at all, and none
of the documentation explained which types are supported or that
<form:password> must be used for password fields.
This commit updates the documentation as follows.
- Document in InputTag, spring-form.tld, and the reference manual that
a `type` can be supplied as a dynamic attribute, that `checkbox` and
`radio` are not supported, and that the bound value is rendered as-is.
- Add notes to InputTag, the reference manual, and spring-form.tld
stating that <form:input type="password"> must not be used and that
<form:password> should be used instead.
- Document in PasswordInputTag, spring-form.tld, and the reference
manual that <form:password> does not render the bound value by default.
Closes gh-37376
Eclipse fails to infer the generic types in XmlEventDecoder and
DefaultWebClient, even though javac and IntelliJ IDEA compile the code
without issues.
This commit introduces explicit type arguments for the calls to
flatMapIterable() and exceptionWrappingFunction() to work around those
bugs.
StandardRepeatableContainers.computeRepeatedAnnotationsMethod()
previously treated any annotation as a container annotation if it
merely declared a `value` attribute returning an array of a
@Repeatable annotated type, without verifying that the repeatable
annotation actually references the candidate container via
@Repeatable.value().
Consequently, an unrelated annotation that happened to have the same
shape as the official container (e.g. a "fake" container with a `value`
attribute returning the same repeatable type) was incorrectly
recognized as a container.
This commit aligns the detection logic with the Java language semantics
by additionally asserting that the container type declared in
@Repeatable.value() is identical to the candidate annotation type.
Closes gh-37326
Signed-off-by: Chengang Guan <guanchengang@qq.com>
- Remove redundant super() calls from constructors
- Add missing @Override annotations
- Use switch rules in JdkClientHttpRequest and RfcUriParser
- Use instanceof pattern matching
- Use method references instead of trivial lambda expressions
- Use lambda expressions instead of anonymous inner classes
- Remove unused code and redundant semicolons
- Use braces with if-blocks
Prior to this commit, `DataBufferUtils` would implement many utility
static methods for managing and processing `DataBuffer` instances.
`DataBuffer` is tightly linked to the reactive space, but its usage
shoudn't be limited to applications that use `Publisher` extensively.
This commit gathers methods that do not depend on `Publisher` into a new
`DataBuffers` type that `DataBufferUtils` now extend. This allows to use
`DataBuffer` instances in a non-reactive case.
Fixes gh-37353
This commit adds a test to MergedAnnotationsTests that verifies a
single primitive attribute in a composed annotation can be aliased via
@AliasFor to a primitive array attribute in a meta-annotation.
See gh-37349
Prior to this commit, `adaptForAttribute(Method, Object)` created
the wrapping array from `value.getClass()` when a single non-array
value was provided for an array attribute. This worked for object
array types but failed for primitive array types: wrapping a boxed
value produced a boxed array, which then failed the compatibility
check and threw an `IllegalStateException`.
This commit derives the component type from the declared attribute
type when it is assignable from the value type, falling back to
`value.getClass()` otherwise. The existing adaptation path for
object array types is therefore preserved, and all primitive array
types now accept a single value.
The accompanying test covers single-value wrapping for every array
type declared by ArrayTypes.
Closes gh-37349
Signed-off-by: Chengang Guan <guanchengang@qq.com>
computeIfAbsent registered the case-insensitive key before invoking the
mapping function. If the function returned null or threw an exception,
no mapping was recorded in the target map, but the key registration was
left behind. The map then reported containsKey(key) as true while size()
was 0, keySet() was empty, and get(key) returned null. A later insertion
with a different casing also reused the stale casing of the failed call,
since the existing-key branch resolved to the registered key.
The case-insensitive key is now only looked up up front. For a new key,
it is registered from within the mapping function once a non-null value
has been computed, which is still before the entry is inserted. A null
result or an exception therefore leaves both maps untouched, while a
removeEldestEntry override that evicts the new entry right away still
removes the registration, as it does for put. The existing-key path
keeps computing under the stored casing.
Closes gh-37351
Signed-off-by: junhyeong9812 <pickjog@gmail.com>
KClass instances representing the same class are not guaranteed to be
identical, so the overridden function return type check introduced in
c39edeff15 could wrongly skip unboxing, for example when a class
implements an interface declaring the same suspending function.
See gh-37191
Prior to this commit, both variants of `CssLinkResourceTransformer`
would use a simple CSS parser for detecting CSS links and delegating to
the transformer for links rewrite.
This commit rewrites the internal parser for a single pass, byte by
byte, memory efficient parsing. This implementation is also more
resistant to edge cases.
Closes gh-37348
Only unbox value class results when the caller expects their unboxed
representation (non-primitive underlying type, non-nullable underlying
type for nullable return types, and no overridden function with a
different return type), and add related tests.
Cache the unbox method resolution per method and make it accessible
to support non-public value classes.
Closes gh-37191
Unbox Kotlin value class results returned from proxied suspending
methods before returning them to the caller.
Spring AOP interceptor chains expose return values as Object, which
causes Kotlin value class results to be boxed. For suspending functions,
the direct return path expects the unboxed value class representation.
Update both CglibAopProxy and JdkDynamicAopProxy to detect value class
return types and unbox boxed results after coroutine adaptation.
Add tests for suspending methods returning value classes.
See gh-37191
See gh-37155
Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
Since Mockito 5.16.1, MockAccess moved from
org.mockito.internal.creation.bytebuddy.MockAccess to
org.mockito.internal.creation.bytebuddy.access.MockAccess.
Consequently, ProxyProcessorSupport.isInternalLanguageInterface() no
longer recognized it, causing an auto-proxied mock created with the
subclass mock maker and proxyTargetClass=false to receive a JDK proxy
that only implements MockAccess instead of a CGLIB proxy of its own
class.
This commit adds a check for the new package name alongside the
existing one, since older Mockito versions may still be on the
classpath.
Closes gh-37342
Prior to this commit, JdbcClient's BatchSpec bound parameters to a
"current" batch entry and separated consecutive entries via add(). That
style was error-prone, since a missing add() still compiled but
silently merged parameters into a single entry. It also did not lend
itself to providing batch parameters dynamically — for example, from an
existing collection of domain objects.
To address that, this commit replaces the chaining style with
self-contained batch entries. BatchSpec now provides entry(...) methods
that define a single entry — via a Consumer<BatchEntry> callback, a
List of positional parameters, or a Map of named parameters — as well
as entries(...) methods that define one entry per parameter object.
Such calls can be freely combined within the same batch.
The new BatchEntry type exposes only the singular param(...) and
paramSource(...) methods. The add() method as well as the param(...),
params(...), and paramSource(...) methods have been removed from
BatchSpec.
Closes gh-37341