Changeset 29626
- Timestamp:
- 01/25/08 15:50:15 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/AbstractSession.java
r29127 r29626 40 40 import org.nuxeo.common.utils.IdUtils; 41 41 import org.nuxeo.common.utils.Path; 42 import org.nuxeo.common.utils.StringUtils;43 42 import org.nuxeo.ecm.core.NXCore; 44 43 import org.nuxeo.ecm.core.api.event.CoreEvent; … … 594 593 String typeName = docModel.getType(); 595 594 DocumentRef parentRef = docModel.getParentRef(); 596 assert typeName != null; 597 assert parentRef != null; 595 if (typeName == null) { 596 throw new ClientException( 597 String.format( 598 "cannot create document '%s' with undefined type name", 599 docModel.getTitle())); 600 } 601 if (parentRef == null) { 602 throw new ClientException( 603 String.format( 604 "cannot create document '%s' with undefined reference to parent document", 605 docModel.getTitle())); 606 } 598 607 try { 599 608 Document folder = resolveReference(parentRef); … … 1305 1314 throws ClientException { 1306 1315 try { 1316 if (docModel.getRef() == null) { 1317 throw new ClientException(String.format( 1318 "cannot save document '%s' with null reference: " 1319 + "document has probably not yet been created " 1320 + "in the repository with " 1321 + "'CoreSession.createDocument(docModel)'", 1322 docModel.getTitle())); 1323 } 1307 1324 Document doc = resolveReference(docModel.getRef()); 1308 1325 checkPermission(doc, WRITE); org.nuxeo.ecm.core/branches/1.4/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentResolver.java
r28609 r29626 55 55 public static Document resolveReference(Session session, DocumentRef docRef) 56 56 throws DocumentException { 57 if (docRef == null) { 58 throw new DocumentException("Invalid reference (null)"); 59 } 57 60 int type = docRef.type(); 58 61 Object ref = docRef.reference();
