Skip to content

Commit daa30a9

Browse files
committed
Consistent use of AnnotationUtils.rethrowAnnotationConfigurationException()
Closes gh-24379
1 parent 984f9de commit daa30a9

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -116,9 +116,7 @@ private void addIfPossible(Deque<AnnotationTypeMapping> queue, @Nullable Annotat
116116
queue.addLast(new AnnotationTypeMapping(source, annotationType, ann));
117117
}
118118
catch (Exception ex) {
119-
if (ex instanceof AnnotationConfigurationException) {
120-
throw (AnnotationConfigurationException) ex;
121-
}
119+
AnnotationUtils.rethrowAnnotationConfigurationException(ex);
122120
if (failureLogger.isEnabled()) {
123121
failureLogger.log("Failed to introspect meta-annotation " + annotationType.getName(),
124122
(source != null ? source.getAnnotationType() : null), ex);

spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1076,7 +1076,7 @@ public static Object getValue(@Nullable Annotation annotation, @Nullable String
10761076
* <p>Otherwise, this method does nothing.
10771077
* @param ex the throwable to inspect
10781078
*/
1079-
private static void rethrowAnnotationConfigurationException(Throwable ex) {
1079+
static void rethrowAnnotationConfigurationException(Throwable ex) {
10801080
if (ex instanceof AnnotationConfigurationException) {
10811081
throw (AnnotationConfigurationException) ex;
10821082
}

spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -672,9 +672,7 @@ private static <A extends Annotation> TypeMappedAnnotation<A> createIfPossible(
672672
valueExtractor, aggregateIndex);
673673
}
674674
catch (Exception ex) {
675-
if (ex instanceof AnnotationConfigurationException) {
676-
throw (AnnotationConfigurationException) ex;
677-
}
675+
AnnotationUtils.rethrowAnnotationConfigurationException(ex);
678676
if (logger.isEnabled()) {
679677
String type = mapping.getAnnotationType().getName();
680678
String item = (mapping.getDistance() == 0 ? "annotation " + type :

0 commit comments

Comments
 (0)