π μ€λͺ
μ€ν, μλͺ»λ μ€μ , λλ½λ μ£Όμ λ± μ¬μν μμ μ μ€λͺ
ν΄μ£ΌμΈμ
ERROR c.m.s.g.e.GlobalExceptionHandler - handleException() in GlobalExceptionHandler throw Exception :
Cannot invoke "com.midas.shootpointer.domain.highlight.entity.HighlightEntity.getHighlightId()" because the
return value of "com.midas.shootpointer.domain.post.entity.PostEntity.getHighlight()" is null
@PostMapping
public ResponseEntity<ApiResponse<Long>> create(
@RequestBody PostRequest request
) {
Member member=SecurityUtils.getCurrentMember();
PostEntity entity=postMapper.dtoToEntity(request,member);
return ResponseEntity.ok(ApiResponse.created(postCommandService.create(entity,member)));
}
- νμ¬ μ ν¨νμ§ μμ
HighlightIdμ λν΄ μ ν¨μ± κ²μ¦μ νκΈ° μ΄μ μ mapper ν΄λμ€λ₯Ό μ΄μ©ν΄ PostEntity ννλ‘ λ§λλ λΆλΆμμ NPE μ€λ₯ λ°μ.
- κ°μ μ΄μ λ‘ κ²μλ¬Ό μμ λΆλΆλ κ°μ μ€λ₯κ° λ°μ.
β
μμ
νλͺ©
ex)
π μ€λͺ
μ€ν, μλͺ»λ μ€μ , λλ½λ μ£Όμ λ± μ¬μν μμ μ μ€λͺ ν΄μ£ΌμΈμ
HighlightIdμ λν΄ μ ν¨μ± κ²μ¦μ νκΈ° μ΄μ μmapperν΄λμ€λ₯Ό μ΄μ©ν΄PostEntityννλ‘ λ§λλ λΆλΆμμ NPE μ€λ₯ λ°μ.β μμ νλͺ©
ex)