NullPointerException when calling AnnotationInfo#getParameterValues
See original GitHub issueI want to get the current value from the io.swagger.annotations.ApiOperation
annotation. In my use case I must get the value for notes
.
final AnnotationInfo annotationInfo = methodInfo.getAnnotationInfo( ApiOperation.class.getName() );
assertThat( annotationInfo ).isNotNull();
final String value = annotationInfo.getParameterValues().get( "notes" ).getValue().toString();
Annotation to get the value from: @ApiOperation(value = "", notes = "${snippetclassifications.findById}", response = RestSnippetClassification.class)
The getParameterValues()
call throws the following NullPointerException
:
java.lang.NullPointerException
at io.github.classgraph.ObjectTypedValueWrapper.getArrayValueClassOrName(ObjectTypedValueWrapper.java:291)
at io.github.classgraph.ObjectTypedValueWrapper.convertWrapperArraysToPrimitiveArrays(ObjectTypedValueWrapper.java:372)
at io.github.classgraph.AnnotationParameterValue.convertWrapperArraysToPrimitiveArrays(AnnotationParameterValue.java:165)
at io.github.classgraph.AnnotationParameterValueList.convertWrapperArraysToPrimitiveArrays(AnnotationParameterValueList.java:110)
at io.github.classgraph.AnnotationInfo.convertWrapperArraysToPrimitiveArrays(AnnotationInfo.java:458)
at io.github.classgraph.ObjectTypedValueWrapper.convertWrapperArraysToPrimitiveArrays(ObjectTypedValueWrapper.java:362)
at io.github.classgraph.AnnotationParameterValue.convertWrapperArraysToPrimitiveArrays(AnnotationParameterValue.java:165)
at io.github.classgraph.AnnotationParameterValueList.convertWrapperArraysToPrimitiveArrays(AnnotationParameterValueList.java:110)
at io.github.classgraph.AnnotationInfo.getParameterValues(AnnotationInfo.java:136)
at de.myview.xom.rest.api.AbstractApiControllerTest.checkApiOperationNotesProperty(AbstractApiControllerTest.java:590)
at de.myview.xom.rest.api.AbstractApiControllerTest.lambda$33(AbstractApiControllerTest.java:578)
This happens when the code tries to get the default-value for the property properties
. This property has following definition:
Extension[] extensions() default @Extension(properties = @ExtensionProperty(name = "", value = ""));
I have used ClassGraph 4.8.47 and attached the verbose output of my test. verbose.log
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >java - What is a NullPointerException, and how do I fix it?
Calling super on a null reference throws a NullPointerException . If you are confused, this is talking about qualified superclass constructor invocations: class ......
Read more >Java NullPointerException - Detect, Fix, and Best Practices
1. NullPointerException when calling an instance method · 2. Java NullPointerException while accessing/modifying field of a null object · 3. Java ...
Read more >Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is thrown when program attempts to use an object reference that has the null value.
Read more >NullPointerException (Java Platform SE 7 ) - Oracle Help Center
Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lukehutch I can confirm that the current snapshot version is working 😃
Thank you for your quick support and the good work. I use ClassGraph a lot and it works like a charm!
@torstenkuhnhenne After a very long time trying to solve issues with both Sonatype and BinTray, Maven deployment is fixed again, and ClassGraph version 4.8.48 should be in Maven Central in a few hours. Sorry for the delay.