在@controller中返回page <s>时抛出空指针和json解析异常

时间:2018-07-15 12:35:33

标签: parsing nullpointerexception

在使用jason web令牌实现后,在@controller类的返回页面中引发空指针和json解析异常

@RequestMapping(value = URIConstants.FETCH_SENSORS, method = RequestMethod.GET)
public @ResponseBody List<Sensor> getAllSensors(
        @RequestParam(value = "status", defaultValue = "enabled") String status,
        @Min(value = 0, message = QueryConstants.PAGE_MIN_INVALID) @RequestParam(required = false, defaultValue = "0") int page,
        @Min(value = 1, message = QueryConstants.LIMIT_MIN_INVALID) @Max(value = 10000, message = QueryConstants.LIMIT_MAX_INVALID) @RequestParam(required = false, defaultValue = "10") int limit) {
    logger.info("Read all from sensors");

    Page<Sensor> pageSensor = service.getAllSensors(status, page, limit);
    logger.info("Read data sensors [{}]", pageSensor.getContent());
    return pageSensor;
}

0 个答案:

没有答案