Skip to content

fix: NPE in ResourceService when blob contentLength is null #1971 - #1972

Merged
astsiapanay merged 2 commits into
developmentfrom
fix/issue-1971
Sep 14, 2026
Merged

astsiapanay merged 2 commits into
developmentfrom
fix/issue-1971

Conversation

@astsiapanay

Copy link
Copy Markdown
Collaborator

Fixes an NPE where ResourceService.toFileMetadata/getResourceStream unboxed a nullable blob-store contentLength into a primitive long.

Applicable issues

Description of changes

  • toFileMetadata: defaults to 0L when Result.contentLength() is null instead of unboxing directly.
  • getResourceStream: treats a null blob-metadata content length as "read fully" (routes through the existing cache/full-read path, which derives length from the actual bytes) instead of comparing null <= maxSizeToCache.
  • Added regression tests in ResourceServiceTest that simulate a blob backend returning a null content length for both code paths; verified they fail without the fix and pass with it.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Guard the nullable contentLength returned by blob-store metadata in
toFileMetadata and getResourceStream, instead of unboxing it directly
into a primitive long. Reachable whenever a FILE/SKILL resource's
Redis cache entry has expired, forcing a cold blob-store metadata
read (e.g. the complex-resource sweep's deliberately long grace
period guarantees this on every reclaim).
Oleksii-Klimov
Oleksii-Klimov previously approved these changes Sep 14, 2026
@Oleksii-Klimov
Oleksii-Klimov dismissed their stale review September 14, 2026 10:26

Need more time

@ai-dial-actions

This comment has been minimized.

@ai-dial-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@astsiapanay
astsiapanay merged commit 3d2b40a into development Sep 14, 2026
15 of 16 checks passed
@astsiapanay
astsiapanay deleted the fix/issue-1971 branch September 14, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in ResourceService.toFileMetadata when blob contentLength is null (complex-resource sweep)

3 participants