源码:
public Integer findTypeById(String type) throws Exception { Integer page = null; System.out.println(type); NewsTypeExample newsTypeExample = new NewsTypeExample(); NewsTypeExample.Criteria criteria = newsTypeExample.createCriteria(); criteria.andTypeDirEqualTo(type); List<NewsType> types = newsTypeMapper.selectByExample(newsTypeExample); try { page = types.get(0).getTypeId(); } catch (IndexOutOfBoundsException e) { throw new CustomException("分类不存在。"); } return page; }
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at com.amoxu.service.impl.NewsServiceImpl.findTypeById(NewsServiceImpl.java:75)
期望的是交给CustomerException处理,系统交给全局的控制器处理了。
目前还有找到原因。
待续
好吧 修改文件之后要在maven里clean之后再运行