Fix #569 Missing param exception

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 7 years ago
parent ab602b7b19
commit 1c995c5de8
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 10
      airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java

@ -41,11 +41,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.subsonic.restapi.*;
import org.subsonic.restapi.Error;
import org.subsonic.restapi.PodcastStatus;
import javax.servlet.http.HttpServletRequest;
@ -140,6 +143,13 @@ public class SubsonicRESTController {
private static final String NOT_YET_IMPLEMENTED = "Not yet implemented";
private static final String NO_LONGER_SUPPORTED = "No longer supported";
@ExceptionHandler(MissingServletRequestParameterException.class)
public void handleMissingRequestParam(HttpServletRequest request,
HttpServletResponse response,
MissingServletRequestParameterException exception) throws Exception {
error(request, response, ErrorCode.MISSING_PARAMETER, "Required param ("+exception.getParameterName()+") is missing");
}
@RequestMapping(value = "/ping")
public void ping(HttpServletRequest request, HttpServletResponse response) throws Exception {
Response res = createResponse();

Loading…
Cancel
Save