mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-19 16:03:19 +00:00
Merge branch 'DependencyTrack:master' into master
This commit is contained in:
commit
3450de7f0f
21 changed files with 249 additions and 91 deletions
|
@ -186,7 +186,7 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
public List<Project> getAllProjects(boolean excludeInactive) {
|
||||
final Query<Project> query = pm.newQuery(Project.class);
|
||||
if (excludeInactive) {
|
||||
query.setFilter("active == true || active == null");
|
||||
query.setFilter("active");
|
||||
}
|
||||
query.setOrdering("id asc");
|
||||
return query.executeList();
|
||||
|
@ -477,9 +477,6 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
if (project.getParent() != null && !Boolean.TRUE.equals(project.getParent().isActive())){
|
||||
throw new IllegalArgumentException("An inactive Parent cannot be selected as parent");
|
||||
}
|
||||
if (project.isActive() == null) {
|
||||
project.setActive(Boolean.TRUE);
|
||||
}
|
||||
final Project oldLatestProject = project.isLatest() ? getLatestProjectVersion(project.getName()) : null;
|
||||
final Project result = callInTransaction(() -> {
|
||||
// Remove isLatest flag from current latest project version, if the new project will be the latest
|
||||
|
@ -715,7 +712,19 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
String directDependencies = project.getDirectDependencies();
|
||||
for (final UUID sourceComponentUuid : projectDirectDepsSourceComponentUuids) {
|
||||
final UUID clonedComponentUuid = clonedComponentUuidBySourceComponentUuid.get(sourceComponentUuid);
|
||||
directDependencies = directDependencies.replace(sourceComponentUuid.toString(), clonedComponentUuid.toString());
|
||||
if (clonedComponentUuid != null) {
|
||||
directDependencies = directDependencies.replace(
|
||||
sourceComponentUuid.toString(), clonedComponentUuid.toString());
|
||||
} else {
|
||||
// NB: This may happen when the source project itself is a clone,
|
||||
// and it was cloned before DT v4.12.0.
|
||||
// https://github.com/DependencyTrack/dependency-track/pull/4171
|
||||
LOGGER.warn("""
|
||||
The source project's directDependencies refer to a component with UUID \
|
||||
%s, which does not exist in the project. The cloned project's dependency graph \
|
||||
may be broken as a result. A BOM upload will resolve the issue.\
|
||||
""".formatted(sourceComponentUuid));
|
||||
}
|
||||
}
|
||||
|
||||
project.setDirectDependencies(directDependencies);
|
||||
|
@ -728,7 +737,16 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
String directDependencies = component.getDirectDependencies();
|
||||
for (final UUID sourceComponentUuid : sourceComponentUuids) {
|
||||
final UUID clonedComponentUuid = clonedComponentUuidBySourceComponentUuid.get(sourceComponentUuid);
|
||||
directDependencies = directDependencies.replace(sourceComponentUuid.toString(), clonedComponentUuid.toString());
|
||||
if (clonedComponentUuid != null) {
|
||||
directDependencies = directDependencies.replace(
|
||||
sourceComponentUuid.toString(), clonedComponentUuid.toString());
|
||||
} else {
|
||||
LOGGER.warn("""
|
||||
The directDependencies of component %s refer to a component with UUID \
|
||||
%s, which does not exist in the source project. The cloned project's dependency graph \
|
||||
may be broken as a result. A BOM upload will resolve the issue.\
|
||||
""".formatted(component, sourceComponentUuid));
|
||||
}
|
||||
}
|
||||
|
||||
component.setDirectDependencies(directDependencies);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue