Authored by caoyan

Merge branch 'test6.9.12' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.12

@@ -11,9 +11,11 @@ import com.yohoufo.common.utils.ServletUtils; @@ -11,9 +11,11 @@ import com.yohoufo.common.utils.ServletUtils;
11 import org.apache.commons.httpclient.HttpStatus; 11 import org.apache.commons.httpclient.HttpStatus;
12 import org.slf4j.Logger; 12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
  14 +import org.springframework.web.bind.MissingServletRequestParameterException;
14 import org.springframework.web.bind.UnsatisfiedServletRequestParameterException; 15 import org.springframework.web.bind.UnsatisfiedServletRequestParameterException;
15 import org.springframework.web.bind.annotation.ControllerAdvice; 16 import org.springframework.web.bind.annotation.ControllerAdvice;
16 import org.springframework.web.bind.annotation.ExceptionHandler; 17 import org.springframework.web.bind.annotation.ExceptionHandler;
  18 +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
17 import org.springframework.web.servlet.ModelAndView; 19 import org.springframework.web.servlet.ModelAndView;
18 20
19 import javax.servlet.http.HttpServletRequest; 21 import javax.servlet.http.HttpServletRequest;
@@ -52,7 +54,9 @@ public class GlobalDefaultExceptionHandler { @@ -52,7 +54,9 @@ public class GlobalDefaultExceptionHandler {
52 } 54 }
53 55
54 //如果是请求URL匹配不了,则返回400 56 //如果是请求URL匹配不了,则返回400
55 - if (e instanceof UnsatisfiedServletRequestParameterException) { 57 + if (e instanceof UnsatisfiedServletRequestParameterException
  58 + || e instanceof MissingServletRequestParameterException
  59 + || e instanceof MethodArgumentTypeMismatchException) {
56 log.warn("can not find validate request mapping at {}", request.getRequestURI()); 60 log.warn("can not find validate request mapping at {}", request.getRequestURI());
57 response.setStatus(HttpStatus.SC_BAD_REQUEST); 61 response.setStatus(HttpStatus.SC_BAD_REQUEST);
58 return new ModelAndView(); 62 return new ModelAndView();