admin管理员组文章数量:1568304
由于对象没有没有new出来直接使用,提示该错误
private List<AuthInfo> authInfoList;
/*此处必须new粗来*/
authInfoList = new ArrayList<AuthInfo>();
AuthInfo authInfo = new AuthInfo();authInfo.setGateName(gate.getName()); authInfo.setType(authorizations.get(i).getType()); authInfo.setTeam(authorizations.get(i).getTeam()); authInfo.setWeek(authorizations.get(i).getWeek()); authInfo.setStartTime(authorizations.get(i).getStartTime()); authInfo.setEndTime(authorizations.get(i).getEndTime()); authInfoList.add(authInfo);
@XmlRootElement(name="commandlist") @XmlAccessorType(XmlAccessType.FIELD) public class CommandList { @XmlElement(name="command") private List<Command> commandList; public List<Command> getCommandList(){return commandList;} public void setCommandList(List<Command> commandList){ this.commandList = commandList; } }
CommandList commandList = new CommandList();commandList.setCommandList(new ArrayList<Command>()); //必须加,否则空指针for(int i=0; i<delIoBean.getGateNameList().size(); i++){ Command command = new Command(); command.setCmd("delIo"); command.setGate(delIoBean.getGateNameList().get(i)); command.setData(""); commandList.getCommandList().add(command); }
本文标签: 错误JavalangNullPointerException
版权声明:本文标题:java.lang.NullPointerException错误 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1726826425a1086131.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论