scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

ClassUtils.setValue tries to set null on primitive fields

Open ctrueden opened this issue 11 years ago • 1 comments

When calling ClassUtils#setValue(field, object, value) with a null value, on a primitive type field, the method ultimately tries to assign the null value to the field, which bombs out with:

java.lang.IllegalArgumentException: Can not set long field foo.bar.myField to null value

This may actually be a problem with the ConversionUtils#convert(Object, Type) method. If the Type is a primitive and the Object is null, it should not return null.

ctrueden avatar Mar 12 '14 16:03 ctrueden

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/change-scijava-parameter-label-at-runtime/60574/6

imagesc-bot avatar Dec 04 '21 18:12 imagesc-bot