从端点获取indexOutOfBoundException

时间:2018-05-17 09:07:45

标签: java

大家好,我一直在努力解决这个问题,我不知道为什么我一直得到indexOutBoundsExpection,下面是我的代码结构

服务层

public CompanyExprience getExperience(User user) {

CompanyExpirience model = new CompanyExpirience();

Long teamXp = (user.getTeams() == null ? 0L : 
((user.getTeams().get(0).getLevel() * 1000) + user.getTeams().get(0).getExperience()));

Long individualXp = ((user.getLevel() * 1000) + user.getExperience());
        model.setIndividualLevel(user.getLevel());
        model.setTeamLevel(user.getTeams() == null ? 0L : user.getTeams().get(0).getLevel());
        model.setTeamStatus(toStatus(user.getTeams() == null ? 0L : user.getTeams().get(0).getLevel()));
        model.setIndividualStatus(toStatus(user.getLevel()));
        model.setIndividualExperience(((individualXp * 100) / 100000));
        model.setTeamExperience(((teamXp * 100) / 100000));
        model.setTeamExperiencePoint(user.getTeams() == null ? 0L : ((user.getTeams().get(0).getLevel() * 1000) + user.getTeams().get(0).getExperience()));
        model.setIndividualExperiencePoint((user.getLevel() * 1000) + user.getExperience());

        return model;

    }

以下是我的终点

@GET
    @Path("/compexpirience")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public ExperienceModel getExperience() {


    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
            User user = (User) auth.getPrincipal();

        return activityService.getExperienceModel(user);
}

有人可以尝试向我解释为什么谷歌浏览器和eclipse堆栈跟踪给我indexOutBoundsException,我知道通常会导致这个错误,我正在努力

0 个答案:

没有答案