Skip to content

Useless exception message when annotations can't be parsed [SPR-12507] #17112

Closed
@spring-projects-issues

Description

@spring-projects-issues

Aaron Digulla opened SPR-12507 and commented

When a class is missing while parsing annotations in StandardAnnotationMetadata.isAnnotated, you get this exception:

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653)
	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460)
	at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286)
	at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
	at java.lang.Class.initAnnotationsIfNecessary(Class.java:3079)
	at java.lang.Class.getAnnotations(Class.java:3059)
	at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:123)

The error means that Java couldn't find a class inside of annotation which has a Class value.

Can you please wrap all exceptions thrown by Class.getAnnotations() with the name of the class which you tried to parse? That would help to narrow down the problem.


Affects: 3.2.10

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions