[ 
http://opencast.jira.com/browse/MH-9164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31681#comment-31681
 ] 

Stephen Marquard commented on MH-9164:
--------------------------------------

The issue here is throwing a WebApplicationException without a status code, 
e.g. in 
modules/matterhorn-usertracking-service-impl/src/main/java/org/opencastproject/usertracking/endpoint/UserTrackingRestService.java:

 // Parse the in and out strings, which might be empty (hence, we can't let 
jax-rs handle them properly)
    if (StringUtils.isEmpty(inString)) {
      throw new 
WebApplicationException(Response.status(Status.BAD_REQUEST).entity("in must be 
a non null integer")
              .build());
    }
    Integer in = null;
    try {
      in = Integer.parseInt(StringUtils.trim(inString));
    } catch (NumberFormatException e) {
      throw new WebApplicationException(e);
    }

    Integer out = null;
    if (StringUtils.isEmpty(outString)) {
      out = in;
    } else {
      try {
        out = Integer.parseInt(StringUtils.trim(outString));
      } catch (NumberFormatException e) {
        throw new WebApplicationException(e);
      }
    }

In the above example, the first exception correctly returns an http 400 (bad 
request) whereas the WebApplicationException without further params returns 
500. Wherever a WebApplicationException is thrown for a known reason, an error 
code plus description should be returned.


                
> malformed usertracking requests cause internal server error
> -----------------------------------------------------------
>
>                 Key: MH-9164
>                 URL: http://opencast.jira.com/browse/MH-9164
>             Project: Matterhorn Project
>          Issue Type: Bug
>          Components: Architecture & Services
>    Affects Versions: Trunk, 1.4, 1.3
>            Reporter: Stephen Marquard
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://opencast.jira.com/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn


To unsubscribe please email
[email protected]
_______________________________________________

Reply via email to