mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-11-01 14:10:57 +00:00
Fix NullPointerException when updating a project (#2319)
* Fix `NullPointerException` in ProjectQueryManager Fixes the `NullPointerException` which occurs when updating a project where `project.isActive() == null` Signed-off-by: RBickert <rbt@mm-software.com> * Prevent NullPointerException in NotificationRouter Signed-off-by: RBickert <rbt@mm-software.com> Signed-off-by: RBickert <rbt@mm-software.com>
This commit is contained in:
parent
2420f97327
commit
a160bd5590
3 changed files with 22 additions and 8 deletions
|
|
@ -487,10 +487,8 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
project.setVersion(version);
|
||||
project.setPurl(purl);
|
||||
|
||||
if (!active && project.isActive() && hasActiveChild(project)){
|
||||
if (!active && Boolean.TRUE.equals(project.isActive()) && hasActiveChild(project)){
|
||||
throw new IllegalArgumentException("Project cannot be set to inactive, if active children are present.");
|
||||
} else {
|
||||
project.setActive(active);
|
||||
}
|
||||
project.setActive(active);
|
||||
|
||||
|
|
@ -522,10 +520,8 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
project.setPurl(transientProject.getPurl());
|
||||
project.setSwidTagId(transientProject.getSwidTagId());
|
||||
|
||||
if (project.isActive() && !Boolean.TRUE.equals(transientProject.isActive()) && hasActiveChild(project)){
|
||||
if (Boolean.TRUE.equals(project.isActive()) && !Boolean.TRUE.equals(transientProject.isActive()) && hasActiveChild(project)){
|
||||
throw new IllegalArgumentException("Project cannot be set to inactive if active children are present.");
|
||||
} else {
|
||||
project.setActive(transientProject.isActive());
|
||||
}
|
||||
project.setActive(transientProject.isActive());
|
||||
|
||||
|
|
@ -1091,7 +1087,7 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
boolean hasActiveChild = false;
|
||||
if (project.getChildren() != null){
|
||||
for (Project child: project.getChildren()) {
|
||||
if (child.isActive() || hasActiveChild) {
|
||||
if (Boolean.TRUE.equals(child.isActive()) || hasActiveChild) {
|
||||
return true;
|
||||
} else {
|
||||
hasActiveChild = hasActiveChild(child);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue