본문 바로가기
Error

NullPointException..

by 함준혁 2023. 4. 21.
List<ReplyVO> replyVOList = new ArrayList<>(); // 내가 가지고 있는 후기 가져오기

        for(int i = 0; i < myBoardList.size() - 1; i++){
            BoardVo boardVo = (BoardVo) myBoardList.get(i); // 게시글 목록을 가져옵니다/
            Long bno = boardVo.getBno(); // 게시글의 글번호를 가져옵니다
            ReplyVO replyVO = replyMapper.readBno(bno);
            replyVOList.add(replyVO);
//            replyVOList.add(replyMapper.readBno(bno)); // 게시글의 글번호를 통하여 후기를 가져옵니다. 그리고 그 후기를 반환할 replyVOList 배열에 추가해줍니다.
            log.info("replyMapper.readBno(bno)란 ? :: " + replyMapper.readBno(bno));
            log.info(replyVO);
            log.info("replyVOList :: " + i + " 번째 " + replyVOList);
        }

new ArrayList<>(); 로 안하고 null으로 초기화해두었더니..
null인상태에서 add를 할시 NullPointException이 발생했다.. 바보같은 나

728x90

'Error' 카테고리의 다른 글

org.apache.ibatis.binding.BindingException(바인딩익셉션)  (0) 2023.04.28