Details
-
Type:
Bug
-
Status: Verified
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 12.3
-
Component/s: Assignments
-
Labels:None
-
12 status:Resolved
-
Test Plan:
Description
When an Assignments model answer does not have a selection for "Show to students", it causes an NPE:
caused by: java.lang.NullPointerException
at org.sakaiproject.assignment.impl.AssignmentSupplementItemServiceImpl.canViewModelAnswer(AssignmentSupplementItemServiceImpl.java:451)
because AssignmentSupplementItemServiceImpl.java has:
int show = m.getShowTo();
which is an autoboxing error (assigning Integer null to int).
The column definition for this field allows NULL values:
CREATE TABLE `ASN_MA_ITEM_T` ( `ID` bigint(20) NOT NULL, `ASSIGNMENT_ID` varchar(255) DEFAULT NULL, `TEXT` varchar(255) DEFAULT NULL, `SHOW_TO` int(11) DEFAULT NULL, PRIMARY KEY (`ID`), CONSTRAINT `FKDE1CE707935EEE07` FOREIGN KEY (`ID`) REFERENCES `ASN_SUP_ITEM_T` (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
This should be fixed:
- In the UI, to require a selection for "show to students"
- In the schema definition, to disallow null values
- In the code, to avoid this common autoboxing error