davemckain / qtiworks

**This project will be closed in early 2023!** IMS QTI 2.1 assessment delivery engine and Java development library (JQTI+). Supports the MathAssess extensions. Replacement for QTIEngine/JQTI and MathAssessEngine/JQTI. Note that this project has now ended and no further work is currently planned.
Other
67 stars 55 forks source link

StringValue#isNull() behavior directly contradicts specification #41

Closed ZackPierce closed 10 years ago

ZackPierce commented 10 years ago

uk.ac.ed.ph.jqtiplus.value.StringValue#isNull() should return true when the wrapped string contents are empty (non-null, but length of 0).

The specification states that "empty containers and empty strings are both treated as NULL."

Presently StringValue#isNull() always returns false, because it does not override the base class SingleValue's default behavior.

The isNull method is widely used throughout the processing portions of JQTI+, and thus this issue impacts the correct behavior of several operators, including core expressions like "And", "Equal", "Or", and naturally, "IsNull".

davemckain commented 10 years ago

Hi Zack,

Thanks for the bug report and sorry for the slow fix. This bug should now be fixed. Analysis of the problem identified a few related issues in the handling of whitespace when building the JQTI+ object model from the DOM, so I've had to fix those too, and there are some minor internal API changes as a result.

Main changes in this fix are:

ZackPierce commented 10 years ago

Dave, thank you for the thorough and thoughtful fix. I'll be updating openoperator to make use of this quite soon.