You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Bryant Luk (JIRA)" <ji...@apache.org> on 2009/07/12 03:23:14 UTC

[jira] Closed: (WINK-49) Annotations[] is null when searchResult is empty (i.e. when on error path)

     [ https://issues.apache.org/jira/browse/WINK-49?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryant Luk closed WINK-49.
--------------------------


> 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
>            Assignee: Bryant Luk
>            Priority: Minor
>             Fix For: 0.1
>
>
> 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.