Skip to content

Commit

Permalink
🐛 [Core] Fixed handling of null KapuaSession on prePersist and preUpd…
Browse files Browse the repository at this point in the history
…ate operation in KapuaEntity

Signed-off-by: Alberto Codutti <[email protected]>
  • Loading branch information
Coduz committed Jan 17, 2025
1 parent 88f427b commit 425f96b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ public void setCreatedBy(KapuaId createdBy) {
@PrePersist
protected void prePersistsAction() {
setId(new KapuaEid(IdGenerator.generate()));
setCreatedBy(KapuaSecurityUtils.getSession().getUserId());
if (KapuaSecurityUtils.getSession() != null) {
setCreatedBy(KapuaSecurityUtils.getSession().getUserId());
}
setCreatedOn(new Date());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ protected void prePersistsAction() {
*/
@PreUpdate
protected void preUpdateAction() {
setModifiedBy(KapuaSecurityUtils.getSession().getUserId());
if (KapuaSecurityUtils.getSession() != null) {
setModifiedBy(KapuaSecurityUtils.getSession().getUserId());
}
setModifiedOn(new Date());
}
}

0 comments on commit 425f96b

Please sign in to comment.