Annotations[] is null when searchResult is empty (i.e. when on error path)
--------------------------------------------------------------------------
Key: WINK-49
URL: https://issues.apache.org/jira/browse/WINK-49
Project: Wink
Issue Type: Bug
Components: Server
Affects Versions: 0.1
Reporter: Bryant Luk
Priority: Minor
In wink-server FlushResultHandler,
Type genericType = null;
Annotation[] declaredAnnotations = null;
SearchResult searchResult = context.getAttribute(SearchResult.class);
if (searchResult != null && searchResult.isFound()) {
Method reflectionMethod =
searchResult.getMethod().getMetadata().getReflectionMethod();
genericType = reflectionMethod.getGenericReturnType();
declaredAnnotations = reflectionMethod.getDeclaredAnnotations();
}
If we're on the error path, declaredAnnotations will remain null. It is
debatable if declaredAnnotations should be:
Annotation[] declaredAnnotations = new Annotation[0];
instead. I think some writer provider code would be like:
boolean isWriteable(java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType) {
... some type checking ...
for(Annotation a : annotations) {
/* do something here */
}
}
which would cause a NPE on the error pass if the type matched. Edge error case
and doesn't block 0.1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.