Source:
public DocumentModel create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) throws IOException { path = getNearestContainerPath(session, path); DocumentModel container = session.getDocument(new PathRef(path)); String docType = getDocType(container); if (docType == null) { docType = getDefaultDocType(); } doSecurityCheck(session, path, docType, typeService); fullname = Normalizer.normalize(fullname, Form.NFC); String filename = FileManagerUtils.fetchFileName(fullname); String title = FileManagerUtils.fetchTitle(filename); content.setFilename(filename); DocumentModel doc; if (isOverwriteByTitle()) { doc = FileManagerUtils.getExistingDocByTitle(session, path, title); } else { doc = FileManagerUtils.getExistingDocByFileName(session, path, filename); } if (overwrite && doc != null) { Blob previousBlob = getBlob(doc); if (previousBlob != null) { BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(previousBlob); if (blobProvider != null && !blobProvider.supportsUserUpdate()) { throw new DocumentSecurityException("Cannot overwrite blob"); } } boolean isDocumentUpdated = updateDocumentIfPossible(doc, content); if (!isDocumentUpdated) { return null; } if (Framework.isBooleanPropertyTrue(SKIP_UPDATE_AUDIT_LOGGING)) { doc.putContextData(DISABLE_AUDIT_LOGGER, true); } doc.putContextData(CoreSession.SOURCE, "fileimporter-" + getName()); doc = doc.getCoreSession().saveDocument(doc); } else { doc = session.createDocumentModel(docType); createDocument(doc, content, title); PathSegmentService pss = Framework.getService(PathSegmentService.class); doc.setPathInfo(path, pss.generatePathSegment(doc)); updateDocument(doc, content); doc.putContextData(CoreSession.SOURCE, "fileimporter-" + getName()); doc = session.createDocument(doc); } session.save(); return doc; }

Target:
public DocumentModel create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) throws IOException { path = getNearestContainerPath(session, path); DocumentModel container = session.getDocument(new PathRef(path)); String docType = getDocType(container); if (docType == null) { docType = getDefaultDocType(); } doSecurityCheck(session, path, docType, typeService); String filename = FileManagerUtils.fetchFileName(fullname); String title = FileManagerUtils.fetchTitle(filename); content.setFilename(filename); DocumentModel doc; if (isOverwriteByTitle()) { doc = FileManagerUtils.getExistingDocByTitle(session, path, title); } else { doc = FileManagerUtils.getExistingDocByFileName(session, path, filename); } if (overwrite && doc != null) { Blob previousBlob = getBlob(doc); if (previousBlob != null) { BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(previousBlob); if (blobProvider != null && !blobProvider.supportsUserUpdate()) { throw new DocumentSecurityException("Cannot overwrite blob"); } } boolean isDocumentUpdated = updateDocumentIfPossible(doc, content); if (!isDocumentUpdated) { return null; } if (Framework.isBooleanPropertyTrue(SKIP_UPDATE_AUDIT_LOGGING)) { doc.putContextData(DISABLE_AUDIT_LOGGER, true); } doc.putContextData(CoreSession.SOURCE, "fileimporter-" + getName()); doc = doc.getCoreSession().saveDocument(doc); } else { doc = session.createDocumentModel(docType); createDocument(doc, content, title); PathSegmentService pss = Framework.getService(PathSegmentService.class); doc.setPathInfo(path, pss.generatePathSegment(doc)); updateDocument(doc, content); doc.putContextData(CoreSession.SOURCE, "fileimporter-" + getName()); doc = session.createDocument(doc); } session.save(); return doc; }