-
Type: Bug
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 7.10, 8.10, 9.10, 10.1
-
Fix Version/s: QualifiedToSchedule
-
Component/s: Core
-
Tags:
To understand what's happening, the following test is failing
@Test public void testName() throws Exception { DocumentModel doc = session.createDocumentModel("/", "test", "Note"); doc.setPropertyValue("dc:title", "Title"); doc = session.createDocument(doc); doc.setPropertyValue("dc:title", "Title"); doc = session.createDocument(doc); doc = session.getDocument(doc.getRef()); assertEquals("Title", doc.getPropertyValue("dc:title")); }
with
java.lang.AssertionError: expected:<Title> but was:<null>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:743)
...
This is because of the reuse of an already attached DocumentModel, then the dc:title is not dirty and the underlying property is not set.
So reusing a DocumentModel that has already a session (attached) should throw an IllegalArgumentException.