You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Paul Lindner (JIRA)" <ji...@apache.org> on 2011/05/09 07:10:03 UTC

[jira] [Resolved] (SHINDIG-1527) It happens NPE when no json object

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

Paul Lindner resolved SHINDIG-1527.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.0

> It happens NPE when no json object
> ----------------------------------
>
>                 Key: SHINDIG-1527
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1527
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: windows xp
>            Reporter: Henry Kang
>            Priority: Minor
>             Fix For: 3.0.0
>
>
> BaseRequestItem.getTypesParameter() calls BeanJsonConverter.convertToObject().
> but if no exists json parameter, means getParameter(parameterName) returns null, 
> it happens null point exception.
> and the method can't handled NPE. (it can control JSONException)
>   public <T> T getTypedParameter(String parameterName, Class<T> dataTypeClass) {
>     try {
>       return converter.convertToObject(getParameter(parameterName), dataTypeClass);
>     } catch (RuntimeException e) {
>       if (e.getCause() instanceof JSONException)
>         throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
>       throw e;
>     }
>   }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira