jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r563796 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
Date Wed, 08 Aug 2007 09:13:07 GMT
Author: angela
Date: Wed Aug  8 02:13:06 2007
New Revision: 563796

URL: http://svn.apache.org/viewvc?view=rev&rev=563796
Log:
redundant try/catch block

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?view=diff&rev=563796&r1=563795&r2=563796
==============================================================================
--- 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
Wed Aug  8 02:13:06 2007
@@ -414,40 +414,35 @@
              *
              * see http://issues.apache.org/jira/browse/JCR-61
              */
-            try {
                 PropertyState conflicting = parent.getPropertyState(nodeInfo.getName());
-                if (conflicting.getStatus() == Status.NEW) {
-                    // assume this property has been imported as well;
-                    // rename conflicting property
-                    // 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()
+ "_");
-                    }
-                    // since name changes, need to find new applicable definition
-                    QPropertyDefinition propDef;
-                    if (conflicting.getValues().length == 1) {
-                        // could be single- or multi-valued (n == 1)
-                        try {
-                            // try single-valued
-                            propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), false);
-                        } catch (ConstraintViolationException cve) {
-                            // try multi-valued
-                            propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), true);
-                        }
-                    } else {
-                        // can only be multi-valued (n == 0 || n > 1)
+            if (conflicting.getStatus() == Status.NEW) {
+                // assume this property has been imported as well;
+                // rename conflicting property
+                // 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()
+ "_");
+                }
+                // since name changes, need to find new applicable definition
+                QPropertyDefinition propDef;
+                if (conflicting.getValues().length == 1) {
+                    // could be single- or multi-valued (n == 1)
+                    try {
+                        // try single-valued
+                        propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), false);
+                    } catch (ConstraintViolationException cve) {
+                        // try multi-valued
                         propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), true);
                     }
-
-                    Operation ap = AddProperty.create(parent, newName, conflicting.getType(),
propDef, conflicting.getValues());
-                    stateMgr.execute(ap);
-                    Operation rm = Remove.create(conflicting);
-                    stateMgr.execute(rm);
+                } else {
+                    // can only be multi-valued (n == 0 || n > 1)
+                    propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parent,
newName, conflicting.getType(), true);
                 }
-            } catch (RepositoryException e) {
-                // should not occur. existance has been checked before
-                throw new RepositoryException(e);
+
+                Operation ap = AddProperty.create(parent, newName, conflicting.getType(),
propDef, conflicting.getValues());
+                stateMgr.execute(ap);
+                Operation rm = Remove.create(conflicting);
+                stateMgr.execute(rm);
             }
         }
 



Mime
View raw message