Cell.cross not working: getting the following error message: Error: "java.lang.NullPointerException"

What happens now is that

  1. if the user doesn't have real values but instead only has null values in the cells of the column requested
    or
  2. if they do not properly provide a String columnName as the 3rd argument

then they get in the Expression Preview the Error: java.lang.NullPointerException which actually is unfriendly and should instead say something like "Cross found no matching cell values".

That's definitely a bug. An exception is never a suitable error message. However, it sounds very much like a bug that I have fixed 13 months ago. Can you please retry your failing case with the 3.8 beta? If it still fails, please update the issue that Martin created with the failure case.

The NullPointerException fix was a "bonus" fix included with https://github.com/OpenRefine/OpenRefine/pull/5634 which was mainly to fix record addressing when using cross().

Bart's error:

Error: java.lang.NullPointerException: Cannot invoke "com.google.refine.ProjectMetadata.getName()" because the return value of "java.util.Map$Entry.getValue()" is null

seems different, so it would be interesting to also get more details about it added to the Github issue. It's possible that there are multiple bugs with similar symptoms.

Tom

1 Like

Hi Thad,
Thanks for the detailed reply. I reproduced your steps and they work fine for me. The issue I'm having is when referencing another project with the cross function; I've only had this issue since replacing my computer. Here's a screenshot of trying to cross from one project to another, with the history displayed and the error shown in the cell. I've double-checked that the project and column names are referenced correctly, and that the values in the key column are trimmed and that the target column ("Language code" is deduplicated.

Because this only began when my computer was replaced, I suspect that the cause is something more idiosyncratic in my computer, but is there anything I should be looking for, or trying as a fix? I'm happy to uninstall old versions of OR and try re-re-installing the package with Java included, but I thought I'd check here first, since I already tried some of those steps and they haven't resolved the issue so far. Let me know if I can send more information or screenshots/videos.

Hi Michael,

Sorry to hear that you're still having issues! If you can try with the OpenRefine 3.8-beta (please backup your workspace first!), you might get more information in the error message. Also, if the projects aren't sensitive, if you could export them and attach them either to the Github issue or here, along with a text version of the cross command, that would be a great help.

Thanks,
Tom

Thanks, Tom. I tried with the 3.8 beta and got the same error message. I've attached the two projects - as I mentioned, I suspect this is less an issue with the cross function and more related to something that went wrong when I changed computers, but I'd be delighted if it turned out to be something simpler. Here's the text of my cross command:

cell.cross("Language data","Language code")[0].cells["Language group"].value

Bibliographic-data.openrefine.tar.gz (16.2 KB)
Language-data.openrefine.tar.gz (6.6 KB)

Thanks for looking at this.

Thanks Michael. Those work fine for me, so I suspect that your OpenRefine workspace is corrupted in some way. If you are comfortable zipping up your workspace and sending to me (and it's not gigantic), I'm happy to take a look, but I have some ideas on the types of corruption which would trigger this behavior, so I can attempt to create a synthetic test set which replicates the problem.

Tom

@tfmorris Error handling looks much better in 3.8-beta1 ; good job!

1 Like

Quick note of thanks to Tom for investigating this, diagnosing the corruption issue in my workspace directory, and providing instructions to fix it.
I don't know if the issues that others reported had the same cause, but mine are now resolved. Thanks!

2 Likes

I came across the same issue when using version 3.7 but upgrading to version 3.8-beta resolved this.

1 Like