Skip to content

SNOW-3053365: Fix NPE when HOME directory cache is not available#2534

Merged
sfc-gh-dheyman merged 3 commits into
masterfrom
03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available
Mar 10, 2026
Merged

SNOW-3053365: Fix NPE when HOME directory cache is not available#2534
sfc-gh-dheyman merged 3 commits into
masterfrom
03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available

Conversation

@sfc-gh-dheyman

@sfc-gh-dheyman sfc-gh-dheyman commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Overview

Fixes a regression in v4.0.0 where SecureStorageLinuxManager throws an unrecoverable ExceptionInInitializerError when no HOME directory is available (e.g., Docker Linux containers). The root cause is FileCacheManager.getCacheFilePath() dereferencing a null cacheFile when the cache directory cannot be resolved. Rather than adding ad-hoc null checks (which is how this regression recurred from the original fix in #2108), this PR introduces an explicit cacheEnabled flag in FileCacheManager that is set only when cache setup succeeds. All public methods check this flag at the top and gracefully no-op when disabled, so the driver continues to function normally without token caching.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sfc-gh-dheyman sfc-gh-dheyman marked this pull request as ready for review March 5, 2026 13:19
@sfc-gh-dheyman sfc-gh-dheyman requested a review from a team as a code owner March 5, 2026 13:19
@sfc-gh-dheyman sfc-gh-dheyman force-pushed the 03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available branch from 048e70a to 5111f64 Compare March 5, 2026 13:20
@sfc-gh-dheyman sfc-gh-dheyman marked this pull request as draft March 5, 2026 13:32
@sfc-gh-dheyman sfc-gh-dheyman force-pushed the 03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available branch from 5111f64 to e7b047e Compare March 5, 2026 13:54
@sfc-gh-dheyman sfc-gh-dheyman marked this pull request as ready for review March 5, 2026 13:55
Comment thread src/main/java/net/snowflake/client/internal/core/FileCacheManagerBuilder.java Outdated
Comment thread src/main/java/net/snowflake/client/internal/core/SecureStorageLinuxManager.java Outdated
Comment thread src/main/java/net/snowflake/client/internal/core/FileCacheManager.java Outdated
@sfc-gh-dheyman sfc-gh-dheyman force-pushed the 03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available branch from e7b047e to c158cf5 Compare March 5, 2026 14:25
@sfc-gh-dheyman sfc-gh-dheyman merged commit c1ccc20 into master Mar 10, 2026
114 of 122 checks passed
@sfc-gh-dheyman sfc-gh-dheyman deleted the 03-05-snow-3053365_fix_npe_when_home_directory_cache_is_not_available branch March 10, 2026 13:11
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants