The new Fiji release and update to pom 33.0.0 earlier this week bumped the version of scijava-ui-swing to 0.17.0. Surprisingly, and sadly, this change broke most of our groovy scripts. When running any script with a script parameter input asking for a MoleculeArchive, the main objects we work with in our software Mars, we get a NullPointerException:

This happens when I run the script with a MoleculeArchive already open:
#@ MoleculeArchive archive
println(archive.getName())
and the dialog opens but is blank...

This was even more exciting because our paper was published yesterday (https://elifesciences.org/articles/75899) and much of it depends on groovy scripts. So somehow after years of testing on the day of publication everything in all of our workflows was broken 😢
I did test with the bundle before the release, but of course I somehow didn't test scripts... I narrowed the problem down to the changes in commit 7d36b38 and in particular these lines now:
|
String[] availableChoices = model.getChoices(); |
|
if (availableChoices != null) { |
|
comboBox = new JComboBox<>(availableChoices); |
|
} else { |
|
comboBox = new JComboBox<>(model.getObjectPool().toArray()); |
|
} |
this change was introduced between version 0.14.0 and 0.15.0
Somehow for our MoleculeArchives availableChoices is an empty list and then when getListCellRendererComponent is called the value is null and the NPE is thrown in the ObjectService when trying to getName...
The else part of the statement works perfectly because model.getObjectPool().toArray() returns a list with the archive and all is good.
However, I think availableChoices will never be null for DefaultMutableModuleItem since the empty list is created upon creation of that type of ModuleItem. So I would imagine this would be a problem for anyone trying to retrieve their particular Objects. Alternatively, maybe there is a mistake in our code or how we define our Objects, but I don't see it currently.
@imagejan do you have any insights here? I will keep investigating but I don't see how to fix the problem without removing this if else statement and leaving the else portion.
For now, the scijava framework came to the rescue. I created MarsSwingObjectWidget in mars-core in our project equivalent to version 0.14.0 with a higher priority to avoid the issue, but I would like to find a fix and remove that...
The new Fiji release and update to pom 33.0.0 earlier this week bumped the version of scijava-ui-swing to 0.17.0. Surprisingly, and sadly, this change broke most of our groovy scripts. When running any script with a script parameter input asking for a MoleculeArchive, the main objects we work with in our software Mars, we get a NullPointerException:

This happens when I run the script with a MoleculeArchive already open:
and the dialog opens but is blank...

This was even more exciting because our paper was published yesterday (https://elifesciences.org/articles/75899) and much of it depends on groovy scripts. So somehow after years of testing on the day of publication everything in all of our workflows was broken 😢
I did test with the bundle before the release, but of course I somehow didn't test scripts... I narrowed the problem down to the changes in commit 7d36b38 and in particular these lines now:
scijava-ui-swing/src/main/java/org/scijava/ui/swing/widget/SwingObjectWidget.java
Lines 81 to 86 in 5c32cba
this change was introduced between version 0.14.0 and 0.15.0
Somehow for our MoleculeArchives availableChoices is an empty list and then when getListCellRendererComponent is called the value is null and the NPE is thrown in the ObjectService when trying to getName...
The else part of the statement works perfectly because model.getObjectPool().toArray() returns a list with the archive and all is good.
However, I think availableChoices will never be null for DefaultMutableModuleItem since the empty list is created upon creation of that type of ModuleItem. So I would imagine this would be a problem for anyone trying to retrieve their particular Objects. Alternatively, maybe there is a mistake in our code or how we define our Objects, but I don't see it currently.
@imagejan do you have any insights here? I will keep investigating but I don't see how to fix the problem without removing this if else statement and leaving the else portion.
For now, the scijava framework came to the rescue. I created MarsSwingObjectWidget in mars-core in our project equivalent to version 0.14.0 with a higher priority to avoid the issue, but I would like to find a fix and remove that...