Skip to content

Conversation

@Kaustav-Sarkar
Copy link

GH-399 Fix setPosition fails with NullPointerException

Fixed a NullPointerException in DenseUnionWriter#setPosition.

The issue was that setPosition tried to update all writers in its internal array, even if they hadn't been initialized yet. I added a null check so it only updates writers that actually exist.

Also added a regression test (TestDenseUnionWriterNPE) to verify the fix and updated .gitignore.

Closes #399.

Added null checks for setPosition and test cases to validate the issue
@Kaustav-Sarkar Kaustav-Sarkar changed the title GH-399 Fix setPosition fails with NullPointerException GH-399: Fix setPosition fails with NullPointerException Dec 24, 2025
@github-actions

This comment has been minimized.

@Kaustav-Sarkar
Copy link
Author

I do not have permissions to set labels

❯ gh pr edit 938 --add-label "bug-fix"

GraphQL: Kaustav-Sarkar does not have the correct permissions to execute `AddLabelsToLabelable` (addLabelsToLabelable)

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Dec 25, 2025
@github-actions github-actions bot added this to the 18.4.0 milestone Dec 25, 2025
@lidavidm lidavidm changed the title GH-399: Fix setPosition fails with NullPointerException GH-399: Check for null writers in DenseUnionWriter#setPosition Dec 25, 2025
Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@lidavidm
Copy link
Member

Ok. The JNI test is an upstream build issue, but @Kaustav-Sarkar can you fix the format error in .gitignore? https://github.com/apache/arrow-java/actions/runs/20526378098/job/59055944634?pr=938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] DenseUnionWriter#setPosition fails with NullPointerException

2 participants