Skip to content

Commit 70581d1

Browse files
chenqimiaosbrannen
andauthored
Improve javadoc in RollbackRuleAttribute regarding nested classes
Closes spring-projectsgh-24682 Co-authored-by: Sam Brannen <[email protected]>
1 parent d85a6c0 commit 70581d1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class RollbackRuleAttribute implements Serializable{
5454
/**
5555
* Create a new instance of the {@code RollbackRuleAttribute} class.
5656
* <p>This is the preferred way to construct a rollback rule that matches
57-
* the supplied {@link Exception} class (and subclasses).
57+
* the supplied {@link Exception} class, its subclasses, and its nested classes.
5858
* @param clazz throwable class; must be {@link Throwable} or a subclass
5959
* of {@code Throwable}
6060
* @throws IllegalArgumentException if the supplied {@code clazz} is

Diff for: spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java

+15
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,19 @@ public void ctorArgExceptionStringNameVersionWithNull() {
8888
new RollbackRuleAttribute((String) null));
8989
}
9090

91+
@Test
92+
public void foundEnclosedExceptionWithEnclosingException() {
93+
RollbackRuleAttribute rr = new RollbackRuleAttribute(EnclosingException.class);
94+
assertThat(rr.getDepth(new EnclosingException.EnclosedException())).isEqualTo(0);
95+
}
96+
97+
@SuppressWarnings("serial")
98+
static class EnclosingException extends RuntimeException {
99+
100+
@SuppressWarnings("serial")
101+
static class EnclosedException extends RuntimeException {
102+
103+
}
104+
}
105+
91106
}

0 commit comments

Comments
 (0)