Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 91774 invoked from network); 17 Aug 2006 16:14:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Aug 2006 16:14:16 -0000 Received: (qmail 13129 invoked by uid 500); 17 Aug 2006 16:14:16 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 13087 invoked by uid 500); 17 Aug 2006 16:14:16 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 13078 invoked by uid 99); 17 Aug 2006 16:14:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Aug 2006 09:14:16 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Aug 2006 09:14:15 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 10E0C1A981A; Thu, 17 Aug 2006 09:13:55 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r432274 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Date: Thu, 17 Aug 2006 16:13:54 -0000 To: commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060817161355.10E0C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: angela Date: Thu Aug 17 09:13:53 2006 New Revision: 432274 URL: http://svn.apache.org/viewvc?rev=432274&view=rev Log: work in progress - readding basic validation checks on importTarget before starting the import. Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=432274&r1=432273&r2=432274&view=diff ============================================================================== --- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original) +++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Thu Aug 17 09:13:53 2006 @@ -23,6 +23,7 @@ import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry; import org.apache.jackrabbit.jcr2spi.state.ItemStateException; import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException; +import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator; import org.apache.jackrabbit.jcr2spi.SessionImpl; import org.apache.jackrabbit.jcr2spi.SessionListener; import org.apache.jackrabbit.jcr2spi.util.ReferenceChangeTracker; @@ -128,13 +129,16 @@ } importTarget = (NodeState) itemState; + // check if import target is writable, not-locked and checked-out. + int options = ItemStateValidator.CHECK_ACCESS | ItemStateValidator.CHECK_LOCK | ItemStateValidator.CHECK_VERSIONING; + session.getValidator().checkIsWritable(importTarget, options); + refTracker = new ReferenceChangeTracker(); parents = new Stack(); parents.push(importTarget); } catch (ItemNotFoundException infe) { throw new PathNotFoundException(LogUtil.safeGetJCRPath(parentPath, session.getNamespaceResolver())); } - // DIFF JR: remove check for overall writability on target-node. } //-----------------------------------------------------------< Importer >--- @@ -402,7 +406,7 @@ if (conflicting.getStatus() == ItemState.STATUS_NEW) { // assume this property has been imported as well; // rename conflicting property - // @todo use better reversible escaping scheme to create unique name + // TODO: use better reversible escaping scheme to create unique name QName newName = new QName(nodeInfo.getName().getNamespaceURI(), nodeInfo.getName().getLocalName() + "_"); if (parent.hasPropertyName(newName)) { newName = new QName(newName.getNamespaceURI(), newName.getLocalName() + "_");