fix: handle missing [workspace.dependencies] in virtual workspace component analysis (#344)#346
Conversation
…ponent analysis (guacsec#344) Add null check for workspaceDepsTable in processWorkspaceDependencies to prevent NPE when a virtual workspace Cargo.toml has [workspace] with members but no [workspace.dependencies] section. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoHandle missing workspace.dependencies section in Cargo virtual workspaces
WalkthroughsDescription• Add null check for missing [workspace.dependencies] section in virtual workspaces • Prevent NullPointerException when processing workspace without dependencies table • Add comprehensive test case with reflection to verify graceful handling Diagramflowchart LR
A["Virtual Workspace Cargo.toml"] -->|"has workspace members"| B["processWorkspaceDependencies"]
B -->|"workspace.dependencies is null"| C["Null Check Added"]
C -->|"log and return early"| D["Graceful Exit"]
C -->|"table exists"| E["Process Dependencies"]
File Changes1. src/main/java/io/github/guacsec/trustifyda/providers/CargoProvider.java
|
Code Review by Qodo
1.
|
ruromero
left a comment
There was a problem hiding this comment.
Actually Qodo is right. We shouldn't add tests using reflection.
|
I have added a second commit to avoid the reflection use in test. |
Add null check for workspaceDepsTable in processWorkspaceDependencies to prevent NPE when a virtual workspace Cargo.toml has [workspace] with members but no [workspace.dependencies] section.
Fixes: #344