DependencyTrack / dependency-track

Dependency-Track is an intelligent Component Analysis platform that allows organizations to identify and reduce risk in the software supply chain.
https://dependencytrack.org/
Apache License 2.0
2.44k stars 531 forks source link

Issue with nullable properties #3756

Open markusmuellerusi opened 1 month ago

markusmuellerusi commented 1 month ago

Current Behavior

public class ProjectMetrics implements Serializable { ... @Persistent @Column(name = "UNASSIGNED_SEVERITY", allowsNull = "true") // New column, must allow nulls on existing databases) private Integer unassigned; ...

Nullable properties should be handled like this: public int getUnassigned() { return unassigned; -> Will fail on MS SQL return unassigned == null ? 0 : unassigned; -> That would be correct }

Steps to Reproduce

  1. Get projects having metrics where "unassigned" is null

Expected Behavior

No error should occur, when getProject().getMetrics().getUnasigned() is called.

Dependency-Track Version

4.11.1

Dependency-Track Distribution

Executable WAR

Database Server

Microsoft SQL Server

Database Server Version

No response

Browser

Microsoft Edge

Checklist

markusmuellerusi commented 3 weeks ago

In issue #3388 (enhancement) I explained this months ago.