Skip to content

ABFS: fix NPE in getCaseInsensitiveEnum when fs.azure.fns.account.service.type is configured - #17

Open
neeraj-kulkarni wants to merge 3 commits into
dremio:branch-3.5.0-dremiofrom
neeraj-kulkarni:azure-bug
Open

ABFS: fix NPE in getCaseInsensitiveEnum when fs.azure.fns.account.service.type is configured#17
neeraj-kulkarni wants to merge 3 commits into
dremio:branch-3.5.0-dremiofrom
neeraj-kulkarni:azure-bug

Conversation

@neeraj-kulkarni

Copy link
Copy Markdown

Summary

  • getConfiguredServiceTypeForFNSAccounts() passed null as the defaultValue to getCaseInsensitiveEnum()
  • When fs.azure.fns.account.service.type IS configured, getCaseInsensitiveEnum calls defaultValue.getDeclaringClass() to resolve the enum type — NPE if defaultValue is null
  • Fix: pass getFsConfiguredServiceType() as the default, which is never null and semantically correct (fall back to the FS-level service type)

Root cause

// Before: passes null — crashes when key is set
return getCaseInsensitiveEnum(FS_AZURE_FNS_ACCOUNT_SERVICE_TYPE, null);

// After: passes a safe non-null default
return getCaseInsensitiveEnum(FS_AZURE_FNS_ACCOUNT_SERVICE_TYPE, getFsConfiguredServiceType());

This bug was latent in the Hadoop 3.5.0 ABFS code — it only manifests when a caller sets fs.azure.fns.account.service.type in the configuration. Dremio's WASB→ABFS shim (Prototype.initConf()) sets this key to BLOB for flat-namespace accounts, which triggered the NPE.

Test plan

  • Unit test: configure fs.azure.fns.account.service.type=BLOB and verify getConfiguredServiceTypeForFNSAccounts() returns BLOB without NPE
  • Existing ABFS tests pass

getConfiguredServiceTypeForFNSAccounts() passed null as the defaultValue
to getCaseInsensitiveEnum(). When fs.azure.fns.account.service.type IS
configured, getCaseInsensitiveEnum calls defaultValue.getDeclaringClass()
to resolve the enum type — NPE if defaultValue is null.

Fix: pass getFsConfiguredServiceType() as the default, which is never null
and matches the intent (fall back to the FS-level service type).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant