Skip to content

Commit d5b58e4

Browse files
committed
CommandModuleItem: do not convert empty strings
If the min(), max() or stepSize() parameter values are the empty string, it means they were unset and should be treated as null/unspecified. This fixes imagej/imagej-omero#46. The problem was that String fields, rather than returning null for min and max, instead were returning the empty string, which was propagated to OMERO, which really did not like that. Really, the SJC framework should have been returning null for min/max in that case anyway.
1 parent 57d0644 commit d5b58e4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/org/scijava/command/CommandModuleItem.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ private T tValue(final String value) {
204204
}
205205

206206
private <D> D tValue(final String value, final Class<D> type) {
207+
if (value == null || value.isEmpty()) return null;
207208
final Class<D> saneType = ConversionUtils.getNonprimitiveType(type);
208209
return ConversionUtils.convert(value, saneType);
209210
}

0 commit comments

Comments
 (0)