jenkinsci / dependency-track-plugin

Main repository for the official Dependency-Track Jenkins plugin
https://dependencytrack.org/
Apache License 2.0
44 stars 27 forks source link

Upload with Parent uuid does not work with 4.10.0 #199

Closed oers closed 10 months ago

oers commented 10 months ago

Describe the bug

Since Updating to dependency-Track 4.10.1 setting the parent does not work anymore.

Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 279f47c4-a43f-4de9-b43e-1789bb0d1ab7
org.jenkinsci.plugins.DependencyTrack.ApiClientException: An error occurred while updating project with id "2cd3b985-df15-4a23-b84c-373b936f0ef9" - HTTP response code: 500 Server Error
    at org.jenkinsci.plugins.DependencyTrack.ApiClient.updateProject(ApiClient.java:358)
    at org.jenkinsci.plugins.DependencyTrack.ApiClient.updateProjectProperties(ApiClient.java:338)
    at org.jenkinsci.plugins.DependencyTrack.DependencyTrackPublisher.updateProjectProperties(DependencyTrackPublisher.java:477)
    at org.jenkinsci.plugins.DependencyTrack.DependencyTrackPublisher.perform(DependencyTrackPublisher.java:281)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

In the server:

2023-12-20 08:13:52,589 ERROR [GlobalExceptionHandler] Uncaught internal server error
java.lang.NullPointerException: Cannot invoke "org.dependencytrack.model.Project.isActive()" because "parent" is null
        at org.dependencytrack.persistence.ProjectQueryManager.updateProject(ProjectQueryManager.java:547)
        at org.dependencytrack.persistence.QueryManager.updateProject(QueryManager.java:435)
        at org.dependencytrack.resources.v1.ProjectResource.updateProject(ProjectResource.java:314)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)

Setting the parent in the GUI works fine. I checked that the parent uuid is correct many times.

                  dependencyTrackPublisher artifact: 'application/target/bom.xml', projectName: xxxxx', projectVersion: env.VERSION, synchronous: true, dependencyTrackApiKey: API_KEY, projectProperties: [parentId: 'df83ec82-3750-41a6-892a-175cd1235754']

Expected behavior

No error, and parent is attributed correctly.

Additional context

Add any other context about the problem here (screenshots, logs, etc.).

sephiroth-j commented 10 months ago

Interesting, to me it looks like a bug in the DT itself. The line of code in question hasn't been updated in a year and the recent changes in the lines before it have no effect on it, in my opinion.

Which version did you update from? Does the parent project still exist at all?

sephiroth-j commented 10 months ago

Closing this issue because it is not a bug of the plugin.