-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 7.10, 8.10, 9.3
-
Component/s: Core
-
Release Notes Summary:List properties with a null element in the first position can be saved
-
Backlog priority:500
-
Sprint:nxcore 10.1.1
-
Story Points:2
- When saving a document, one might get the following stack trace:
Caused by: java.lang.NullPointerException at org.nuxeo.ecm.core.storage.BaseDocument.writeComplexProperty(BaseDocument.java:814) at org.nuxeo.ecm.core.storage.BaseDocument.writeComplexProperty(BaseDocument.java:748) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.writeDocumentPart(SQLDocumentLive.java:176) at org.nuxeo.ecm.core.api.DocumentModelFactory.writeDocumentModel(DocumentModelFactory.java:236) at org.nuxeo.ecm.core.api.AbstractSession.writeModel(AbstractSession.java:366) at org.nuxeo.ecm.core.api.AbstractSession.saveDocument(AbstractSession.java:1529) at com.nuxeo.pleiade.diffusion.web.mail.MailActionsBean.saveCurrentEmail(MailActionsBean.java:352)
- This is located here in the BaseDocument class:
if (list.isEmpty()) { array = new Object[0]; } else { // use properly-typed array, useful for mem backend that doesn't re-convert all types Class<?> klass = list.get(0).getClass(); array = (Object[]) Array.newInstance(klass, list.size()); }
list.get(0) is not tested for nullity.
- Just below another piece of code does it though:
Class<?> klass = Object.class; for (Object o : ar) { if (o != null) { klass = o.getClass(); break; } }
- The same issue is present from 7.10 to master.
- is related to
-
NXP-18134 Don't crash on reading array with initial null
- Resolved