Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forEachIndex with array containing null values throw NullPointerException #6598

Closed
iomicifikko opened this issue May 10, 2024 · 0 comments · Fixed by #6606
Closed

forEachIndex with array containing null values throw NullPointerException #6598

iomicifikko opened this issue May 10, 2024 · 0 comments · Fixed by #6606
Labels
grel The default expression language, GREL, could be improved in many ways! Type: Bug Issues related to software defects or unexpected behavior, which require resolution.

Comments

@iomicifikko
Copy link

iomicifikko commented May 10, 2024

Summary

forEachIndex(["a","b",null], i, x, x) should return the original array rather than throwing an error as it currently does.

>>> OK

image

image

image

image

.
.
.
>>> KO

image

image

image

Expected Behavior

In my opinion the code shoud always output the original array

Versions

  • Operating System: Windows 11
  • OpenRefine: 3.7.9 with builtin java
@iomicifikko iomicifikko added Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators Type: Bug Issues related to software defects or unexpected behavior, which require resolution. labels May 10, 2024
@tfmorris tfmorris added grel The default expression language, GREL, could be improved in many ways! and removed Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators labels May 10, 2024
@tfmorris tfmorris changed the title Wrong behavior of forEachIndex and arrays with null values forEachIndex with array containing null values throw NullPointerException May 10, 2024
tfmorris added a commit to tfmorris/OpenRefine that referenced this issue May 15, 2024
…#6598

- forEachIndex([], k, v, v) should return original array no matter
what the contents of the array.
- fix tests to not rely on join() since its null handling is broken.
tfmorris added a commit to tfmorris/OpenRefine that referenced this issue May 15, 2024
…#6598

- forEachIndex([], k, v, v) should return original array no matter
what the contents of the array.
- fix tests to not rely on join() since its null handling is broken.
wetneb pushed a commit that referenced this issue May 15, 2024
* Handle empty first element correctly. Fixes #3290

* Add tests for join() of JSON array

* Lint

* Fix NullPointerException in forEachIndex with nulls. Fixes #6598

- forEachIndex([], k, v, v) should return original array no matter
what the contents of the array.
- fix tests to not rely on join() since its null handling is broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grel The default expression language, GREL, could be improved in many ways! Type: Bug Issues related to software defects or unexpected behavior, which require resolution.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants