diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
index 8724a19738..d706674d72 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
@@ -107,32 +107,32 @@ class TransactionAspectTests {
void defaultCommitOnAnnotatedClass() {
Exception ex = new Exception();
assertThatException()
- .isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), false))
- .isSameAs(ex);
+ .isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), false))
+ .isSameAs(ex);
}
@Test
void defaultRollbackOnAnnotatedClass() {
RuntimeException ex = new RuntimeException();
assertThatRuntimeException()
- .isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), true))
- .isSameAs(ex);
+ .isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), true))
+ .isSameAs(ex);
}
@Test
void defaultCommitOnSubclassOfAnnotatedClass() {
Exception ex = new Exception();
assertThatException()
- .isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalAnnotation().echo(ex), false))
- .isSameAs(ex);
+ .isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalAnnotation().echo(ex), false))
+ .isSameAs(ex);
}
@Test
void defaultCommitOnSubclassOfClassWithTransactionalMethodAnnotated() {
Exception ex = new Exception();
assertThatException()
- .isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalMethodAnnotation().echo(ex), false))
- .isSameAs(ex);
+ .isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalMethodAnnotation().echo(ex), false))
+ .isSameAs(ex);
}
@Test
@@ -168,8 +168,8 @@ class TransactionAspectTests {
txManager.clear();
assertThat(txManager.begun).isEqualTo(0);
assertThatExceptionOfType(Throwable.class)
- .isThrownBy(toc::performTransactionalOperation)
- .isSameAs(expected);
+ .isThrownBy(toc::performTransactionalOperation)
+ .isSameAs(expected);
assertThat(txManager.begun).isEqualTo(0);
}
diff --git a/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java b/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java
index 3886e08594..460d860f85 100644
--- a/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java
+++ b/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
nestedPath = "";
}
nestedPath = canonicalFieldName(nestedPath);
- if (nestedPath.length() > 0 && !nestedPath.endsWith(NESTED_PATH_SEPARATOR)) {
+ if (!nestedPath.isEmpty() && !nestedPath.endsWith(NESTED_PATH_SEPARATOR)) {
nestedPath += NESTED_PATH_SEPARATOR;
}
this.nestedPath = nestedPath;
diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java
index 440753b827..9394b6836c 100644
--- a/spring-core/src/main/java/org/springframework/util/StringUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -791,6 +791,7 @@ public abstract class StringUtils {
* and {@code "0"} through {@code "9"} stay the same.
*
Special characters {@code "-"}, {@code "_"}, {@code "."}, and {@code "*"} stay the same.
* A sequence "{@code %xy}" is interpreted as a hexadecimal representation of the character.
+ * For all other characters (including those already decoded), the output is undefined.
*
* @param source the encoded String
* @param charset the character set
@@ -876,7 +877,7 @@ public abstract class StringUtils {
@SuppressWarnings("deprecation") // for Locale constructors on JDK 19
@Nullable
public static Locale parseLocaleString(String localeString) {
- if (localeString.equals("")) {
+ if (localeString.isEmpty()) {
return null;
}
diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/Ejb3TransactionAnnotationParser.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/Ejb3TransactionAnnotationParser.java
index ae8e5d2374..52fd72c192 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/annotation/Ejb3TransactionAnnotationParser.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/Ejb3TransactionAnnotationParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,11 +28,12 @@ import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
import org.springframework.transaction.interceptor.TransactionAttribute;
/**
- * Strategy implementation for parsing EJB3's {@link jakarta.ejb.TransactionAttribute}
- * annotation.
+ * Strategy implementation for parsing EJB3's {@link jakarta.ejb.TransactionAttribute} annotation.
*
* @author Juergen Hoeller
* @since 2.5
+ * @see SpringTransactionAnnotationParser
+ * @see JtaTransactionAnnotationParser
*/
@SuppressWarnings("serial")
public class Ejb3TransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
index 1f4a2db53e..d39fe8fa7e 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -163,10 +163,10 @@ import org.springframework.core.Ordered;
public @interface EnableTransactionManagement {
/**
- * Indicate whether subclass-based (CGLIB) proxies are to be created ({@code true}) as
- * opposed to standard Java interface-based proxies ({@code false}). The default is
- * {@code false}. Applicable only if {@link #mode()} is set to
- * {@link AdviceMode#PROXY}.
+ * Indicate whether subclass-based (CGLIB) proxies are to be created ({@code true})
+ * as opposed to standard Java interface-based proxies ({@code false}).
+ * The default is {@code false}. Applicable only if {@link #mode()}
+ * is set to {@link AdviceMode#PROXY}.
* Note that setting this attribute to {@code true} will affect all
* Spring-managed beans requiring proxying, not just those marked with
* {@code @Transactional}. For example, other beans marked with Spring's
diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/JtaTransactionAnnotationParser.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/JtaTransactionAnnotationParser.java
index 9e3b956848..ab933c6c11 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/annotation/JtaTransactionAnnotationParser.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/JtaTransactionAnnotationParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ import org.springframework.transaction.interceptor.TransactionAttribute;
*
* @author Juergen Hoeller
* @since 4.0
+ * @see SpringTransactionAnnotationParser
+ * @see Ejb3TransactionAnnotationParser
*/
@SuppressWarnings("serial")
public class JtaTransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
@@ -65,7 +67,7 @@ public class JtaTransactionAnnotationParser implements TransactionAnnotationPars
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
rbta.setPropagationBehaviorName(
- RuleBasedTransactionAttribute.PREFIX_PROPAGATION + attributes.getEnum("value").toString());
+ RuleBasedTransactionAttribute.PREFIX_PROPAGATION + attributes.getEnum("value"));
List rollbackRules = new ArrayList<>();
for (Class> rbRule : attributes.getClassArray("rollbackOn")) {
diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java
index 01db4e6e01..36dd09936b 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,8 @@ import org.springframework.util.StringUtils;
* @author Juergen Hoeller
* @author Mark Paluch
* @since 2.5
+ * @see JtaTransactionAnnotationParser
+ * @see Ejb3TransactionAnnotationParser
*/
@SuppressWarnings("serial")
public class SpringTransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java
index 250bb2a236..12a20d13e2 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
/**
* Winning rule is the shallowest rule (that is, the closest in the
* inheritance hierarchy to the exception). If no rule applies (-1),
- * return false.
+ * return {@code false}.
* @see TransactionAttribute#rollbackOn(java.lang.Throwable)
*/
@Override
diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java
index e58cfcf262..b4216ed8b2 100644
--- a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java
+++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java
@@ -288,8 +288,8 @@ class EnableTransactionManagementTests {
}
@Test
- void gh24502AppliesTransactionOnlyOnAnnotatedInterface() {
- AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Gh24502ConfigA.class);
+ void gh24502AppliesTransactionFromAnnotatedInterface() {
+ AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Gh24502Config.class);
Object bean = ctx.getBean("testBean");
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
@@ -590,7 +590,7 @@ class EnableTransactionManagementTests {
@Configuration
@EnableTransactionManagement
- static class Gh24502ConfigA {
+ static class Gh24502Config {
@Bean
public MixedTransactionalTestService testBean() {
diff --git a/spring-tx/src/testFixtures/java/org/springframework/transaction/testfixture/TestTransactionExecutionListener.java b/spring-tx/src/testFixtures/java/org/springframework/transaction/testfixture/TestTransactionExecutionListener.java
index f024d68f15..66f9e88e66 100644
--- a/spring-tx/src/testFixtures/java/org/springframework/transaction/testfixture/TestTransactionExecutionListener.java
+++ b/spring-tx/src/testFixtures/java/org/springframework/transaction/testfixture/TestTransactionExecutionListener.java
@@ -49,34 +49,34 @@ public class TestTransactionExecutionListener implements TransactionExecutionLis
@Override
- public void beforeBegin(TransactionExecution transactionState) {
+ public void beforeBegin(TransactionExecution transaction) {
this.beforeBeginCalled = true;
}
@Override
- public void afterBegin(TransactionExecution transactionState, @Nullable Throwable beginFailure) {
+ public void afterBegin(TransactionExecution transaction, @Nullable Throwable beginFailure) {
this.afterBeginCalled = true;
this.beginFailure = beginFailure;
}
@Override
- public void beforeCommit(TransactionExecution transactionState) {
+ public void beforeCommit(TransactionExecution transaction) {
this.beforeCommitCalled = true;
}
@Override
- public void afterCommit(TransactionExecution transactionState, @Nullable Throwable commitFailure) {
+ public void afterCommit(TransactionExecution transaction, @Nullable Throwable commitFailure) {
this.afterCommitCalled = true;
this.commitFailure = commitFailure;
}
@Override
- public void beforeRollback(TransactionExecution transactionState) {
+ public void beforeRollback(TransactionExecution transaction) {
this.beforeRollbackCalled = true;
}
@Override
- public void afterRollback(TransactionExecution transactionState, @Nullable Throwable rollbackFailure) {
+ public void afterRollback(TransactionExecution transaction, @Nullable Throwable rollbackFailure) {
this.afterRollbackCalled = true;
this.rollbackFailure = rollbackFailure;
}