Consistent use of AnnotationUtils.rethrowAnnotationConfigurationException()

Closes gh-24379
This commit is contained in:
Sam Brannen 2020-01-16 18:19:11 +01:00
parent 984f9de191
commit daa30a9f0b
3 changed files with 6 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -116,9 +116,7 @@ final class AnnotationTypeMappings {
queue.addLast(new AnnotationTypeMapping(source, annotationType, ann)); queue.addLast(new AnnotationTypeMapping(source, annotationType, ann));
} }
catch (Exception ex) { catch (Exception ex) {
if (ex instanceof AnnotationConfigurationException) { AnnotationUtils.rethrowAnnotationConfigurationException(ex);
throw (AnnotationConfigurationException) ex;
}
if (failureLogger.isEnabled()) { if (failureLogger.isEnabled()) {
failureLogger.log("Failed to introspect meta-annotation " + annotationType.getName(), failureLogger.log("Failed to introspect meta-annotation " + annotationType.getName(),
(source != null ? source.getAnnotationType() : null), ex); (source != null ? source.getAnnotationType() : null), ex);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -1076,7 +1076,7 @@ public abstract class AnnotationUtils {
* <p>Otherwise, this method does nothing. * <p>Otherwise, this method does nothing.
* @param ex the throwable to inspect * @param ex the throwable to inspect
*/ */
private static void rethrowAnnotationConfigurationException(Throwable ex) { static void rethrowAnnotationConfigurationException(Throwable ex) {
if (ex instanceof AnnotationConfigurationException) { if (ex instanceof AnnotationConfigurationException) {
throw (AnnotationConfigurationException) ex; throw (AnnotationConfigurationException) ex;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -672,9 +672,7 @@ final class TypeMappedAnnotation<A extends Annotation> extends AbstractMergedAnn
valueExtractor, aggregateIndex); valueExtractor, aggregateIndex);
} }
catch (Exception ex) { catch (Exception ex) {
if (ex instanceof AnnotationConfigurationException) { AnnotationUtils.rethrowAnnotationConfigurationException(ex);
throw (AnnotationConfigurationException) ex;
}
if (logger.isEnabled()) { if (logger.isEnabled()) {
String type = mapping.getAnnotationType().getName(); String type = mapping.getAnnotationType().getName();
String item = (mapping.getDistance() == 0 ? "annotation " + type : String item = (mapping.getDistance() == 0 ? "annotation " + type :