jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r178206 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: BatchedItemOperations.java nodetype/EffectiveNodeType.java nodetype/ItemDef.java nodetype/NodeDef.java nodetype/PropDef.java xml/SessionImporter.java xml/WorkspaceImporter.java
Date Tue, 24 May 2005 17:03:17 GMT
Author: stefan
Date: Tue May 24 10:03:06 2005
New Revision: 178206

URL: http://svn.apache.org/viewcvs?rev=178206&view=rev
Log:
fixed bug JCR-124: Session.import() fails to resolve proper property definition in some cases

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDef.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeDef.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDef.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
Tue May 24 10:03:06 2005
@@ -899,7 +899,13 @@
     /**
      * Helper method that finds the applicable definition for a property with
      * the given name, type and multiValued characteristic in the parent node's
-     * node type and mixin types.
+     * node type and mixin types. If there more than one applicable definitions
+     * then the following rules are applied:
+     * <ul>
+     * <li>named definitions are preferred to residual definitions</li>
+     * <li>definitions with specific required type are preferred to definitions
+     * with required type UNDEFINED</li>
+     * </ul>
      *
      * @param name
      * @param type
@@ -917,6 +923,36 @@
             throws RepositoryException, ConstraintViolationException {
         EffectiveNodeType entParent = getEffectiveNodeType(parentState);
         return entParent.getApplicablePropertyDef(name, type, multiValued);
+    }
+
+    /**
+     * Helper method that finds the applicable definition for a property with
+     * the given name, type in the parent node's node type and mixin types.
+     * Other than <code>{@link #findApplicablePropertyDefinition(QName, int, boolean,
NodeState)}</code>
+     * this method does not take the multiValued flag into account in the
+     * selection algorithm. If there more than one applicable definitions then
+     * the following rules are applied:
+     * <ul>
+     * <li>named definitions are preferred to residual definitions</li>
+     * <li>definitions with specific required type are preferred to definitions
+     * with required type UNDEFINED</li>
+     * <li>single-value definitions are preferred to multiple-value definitions</li>
+     * </ul>
+     *
+     * @param name
+     * @param type
+     * @param parentState
+     * @return a <code>PropDef</code>
+     * @throws ConstraintViolationException if no applicable property definition
+     *                                      could be found
+     * @throws RepositoryException          if another error occurs
+     */
+    public PropDef findApplicablePropertyDefinition(QName name,
+                                                    int type,
+                                                    NodeState parentState)
+            throws RepositoryException, ConstraintViolationException {
+        EffectiveNodeType entParent = getEffectiveNodeType(parentState);
+        return entParent.getApplicablePropertyDef(name, type);
     }
 
     //--------------------------------------------< low-level item operations >

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
Tue May 24 10:03:06 2005
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.log4j.Logger;
 
 import javax.jcr.PropertyType;
@@ -127,7 +127,7 @@
                         if (cnda[i].isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions
for '"
-                                + name + "' in node type '" + ntName + "'";
+                                    + name + "' in node type '" + ntName + "'";
                             log.debug(msg);
                             throw new NodeTypeConflictException(msg);
                         }
@@ -159,7 +159,7 @@
                         if (pda[i].isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions
for '"
-                                + name + "' in node type '" + ntName + "'";
+                                    + name + "' in node type '" + ntName + "'";
                             log.debug(msg);
                             throw new NodeTypeConflictException(msg);
                         }
@@ -201,25 +201,40 @@
     }
 
     public ItemDef[] getAllItemDefs() {
+        if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
             defs.addAll((List) iter.next());
         }
         defs.addAll(unnamedItemDefs);
+        if (defs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
+        }
         return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
     public ItemDef[] getNamedItemDefs() {
+        if (namedItemDefs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
             defs.addAll((List) iter.next());
         }
+        if (defs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
+        }
         return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
     public ItemDef[] getUnnamedItemDefs() {
+        if (unnamedItemDefs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
+        }
         return (ItemDef[]) unnamedItemDefs.toArray(new ItemDef[unnamedItemDefs.size()]);
     }
 
@@ -229,13 +244,16 @@
 
     public ItemDef[] getNamedItemDefs(QName name) {
         List defs = (List) namedItemDefs.get(name);
-        if (defs == null) {
-            return null;
+        if (defs == null || defs.size() == 0) {
+            return ItemDef.EMPTY_ARRAY;
         }
         return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
     public NodeDef[] getAllNodeDefs() {
+        if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
@@ -255,10 +273,16 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     public NodeDef[] getNamedNodeDefs() {
+        if (namedItemDefs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -271,10 +295,35 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
+    }
+
+    public NodeDef[] getNamedNodeDefs(QName name) {
+        List list = (List) namedItemDefs.get(name);
+        if (list == null || list.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
+        ArrayList defs = new ArrayList(list.size());
+        Iterator iter = list.iterator();
+        while (iter.hasNext()) {
+            ItemDef def = (ItemDef) iter.next();
+            if (def.definesNode()) {
+                defs.add(def);
+            }
+        }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     public NodeDef[] getUnnamedNodeDefs() {
+        if (unnamedItemDefs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
@@ -283,12 +332,18 @@
                 defs.add(def);
             }
         }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     public NodeDef[] getAutoCreateNodeDefs() {
         // since auto-create items must have a name,
         // we're only searching the named item definitions
+        if (namedItemDefs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -301,10 +356,16 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     public PropDef[] getAllPropDefs() {
+        if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
@@ -324,10 +385,16 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
     public PropDef[] getNamedPropDefs() {
+        if (namedItemDefs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -340,10 +407,35 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
+        return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
+    }
+
+    public PropDef[] getNamedPropDefs(QName name) {
+        List list = (List) namedItemDefs.get(name);
+        if (list == null || list.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
+        ArrayList defs = new ArrayList(list.size());
+        Iterator iter = list.iterator();
+        while (iter.hasNext()) {
+            ItemDef def = (ItemDef) iter.next();
+            if (!def.definesNode()) {
+                defs.add(def);
+            }
+        }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
     public PropDef[] getUnnamedPropDefs() {
+        if (unnamedItemDefs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
@@ -352,12 +444,18 @@
                 defs.add(def);
             }
         }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
     public PropDef[] getAutoCreatePropDefs() {
         // since auto-create items must have a name,
         // we're only searching the named item definitions
+        if (namedItemDefs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -370,12 +468,18 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
     public PropDef[] getMandatoryPropDefs() {
         // since mandatory items must have a name,
         // we're only searching the named item definitions
+        if (namedItemDefs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -388,12 +492,18 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return PropDef.EMPTY_ARRAY;
+        }
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
     public NodeDef[] getMandatoryNodeDefs() {
         // since mandatory items must have a name,
         // we're only searching the named item definitions
+        if (namedItemDefs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
@@ -406,6 +516,9 @@
                 }
             }
         }
+        if (defs.size() == 0) {
+            return NodeDef.EMPTY_ARRAY;
+        }
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
@@ -577,7 +690,13 @@
 
     /**
      * Returns the applicable property definition for a property with the
-     * specified name, type and multiValued characteristic.
+     * specified name, type and multiValued characteristic. If there more than
+     * one applicable definitions then the following rules are applied:
+     * <ul>
+     * <li>named definitions are preferred to residual definitions</li>
+     * <li>definitions with specific required type are preferred to definitions
+     * with required type UNDEFINED</li>
+     * </ul>
      *
      * @param name
      * @param type
@@ -590,48 +709,130 @@
                                             boolean multiValued)
             throws ConstraintViolationException {
         // try named property definitions first
-        ItemDef[] defs = getNamedItemDefs(name);
-        if (defs != null) {
-            for (int i = 0; i < defs.length; i++) {
-                ItemDef def = defs[i];
-                if (!def.definesNode()) {
-                    PropDef pd = (PropDef) def;
-                    int reqType = pd.getRequiredType();
-                    // property definition with that name exists
-                    // match type
-                    if (reqType == PropertyType.UNDEFINED
-                            || type == PropertyType.UNDEFINED
-                            || reqType == type) {
-                        // match multiValued flag
-                        if (multiValued == pd.isMultiple()) {
-                            // found match
-                            return pd;
+        PropDef match =
+                getMatchingPropDef(getNamedPropDefs(name), type, multiValued);
+        if (match != null) {
+            return match;
+        }
+
+        // no item with that name defined;
+        // try residual property definitions
+        match = getMatchingPropDef(getUnnamedPropDefs(), type, multiValued);
+        if (match != null) {
+            return match;
+        }
+
+        // no applicable definition found
+        throw new ConstraintViolationException("no matching property definition found for
" + name);
+    }
+
+    /**
+     * Returns the applicable property definition for a property with the
+     * specified name and type. The multiValued flag is not taken into account
+     * in the selection algorithm. Other than
+     * <code>{@link #getApplicablePropertyDef(QName, int, boolean)}</code>
+     * this method does not take the multiValued flag into account in the
+     * selection algorithm. If there more than one applicable definitions then
+     * the following rules are applied:
+     * <ul>
+     * <li>named definitions are preferred to residual definitions</li>
+     * <li>definitions with specific required type are preferred to definitions
+     * with required type UNDEFINED</li>
+     * <li>single-value definitions are preferred to multiple-value definitions</li>
+     * </ul>
+     *
+     * @param name
+     * @param type
+     * @return
+     * @throws ConstraintViolationException if no applicable property definition
+     *                                      could be found
+     */
+    public PropDef getApplicablePropertyDef(QName name, int type)
+            throws ConstraintViolationException {
+        // try named property definitions first
+        PropDef match = getMatchingPropDef(getNamedPropDefs(name), type);
+        if (match != null) {
+            return match;
+        }
+
+        // no item with that name defined;
+        // try residual property definitions
+        match = getMatchingPropDef(getUnnamedPropDefs(), type);
+        if (match != null) {
+            return match;
+        }
+
+        // no applicable definition found
+        throw new ConstraintViolationException("no matching property definition found for
" + name);
+    }
+
+    private PropDef getMatchingPropDef(PropDef[] defs, int type) {
+        PropDef match = null;
+        for (int i = 0; i < defs.length; i++) {
+            ItemDef def = defs[i];
+            if (!def.definesNode()) {
+                PropDef pd = (PropDef) def;
+                int reqType = pd.getRequiredType();
+                // match type
+                if (reqType == PropertyType.UNDEFINED
+                        || type == PropertyType.UNDEFINED
+                        || reqType == type) {
+                    if (match == null) {
+                        match = pd;
+                    } else {
+                        // check if this definition is a better match than
+                        // the one we've already got
+                        if (match.getRequiredType() != pd.getRequiredType()) {
+                            if (match.getRequiredType() == PropertyType.UNDEFINED) {
+                                // found better match
+                                match = pd;
+                            }
+                        } else {
+                            if (match.isMultiple() && !pd.isMultiple()) {
+                                // found better match
+                                match = pd;
+                            }
                         }
                     }
+                    if (match.getRequiredType() != PropertyType.UNDEFINED
+                            && !match.isMultiple()) {
+                        // found best possible match, get outta here
+                        return match;
+                    }
                 }
             }
         }
+        return match;
+    }
 
-        // no item with that name defined;
-        // try residual property definitions
-        PropDef[] pda = getUnnamedPropDefs();
-        for (int i = 0; i < pda.length; i++) {
-            PropDef pd = pda[i];
-            int reqType = pd.getRequiredType();
-            // match type
-            if (reqType == PropertyType.UNDEFINED
-                    || type == PropertyType.UNDEFINED
-                    || reqType == type) {
-                // match multiValued flag
-                if (multiValued == pd.isMultiple()) {
-                    // found match
-                    return pd;
+    private PropDef getMatchingPropDef(PropDef[] defs, int type,
+                                       boolean multiValued) {
+        PropDef match = null;
+        for (int i = 0; i < defs.length; i++) {
+            ItemDef def = defs[i];
+            if (!def.definesNode()) {
+                PropDef pd = (PropDef) def;
+                int reqType = pd.getRequiredType();
+                // match type
+                if (reqType == PropertyType.UNDEFINED
+                        || type == PropertyType.UNDEFINED
+                        || reqType == type) {
+                    // match multiValued flag
+                    if (multiValued == pd.isMultiple()) {
+                        // found match
+                        if (pd.getRequiredType() != PropertyType.UNDEFINED) {
+                            // found best possible match, get outta here
+                            return pd;
+                        } else {
+                            if (match == null) {
+                                match = pd;
+                            }
+                        }
+                    }
                 }
             }
         }
-
-        // no applicable definition found
-        throw new ConstraintViolationException("no matching property definition found for
" + name);
+        return match;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDef.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDef.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ItemDef.java Tue
May 24 10:03:06 2005
@@ -28,6 +28,8 @@
  */
 public interface ItemDef {
 
+    public static final ItemDef[] EMPTY_ARRAY = new ItemDef[0];
+
     /**
      * '*' denoting residual child item definition
      */

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeDef.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeDef.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeDef.java Tue
May 24 10:03:06 2005
@@ -27,6 +27,8 @@
  */
 public interface NodeDef extends ItemDef {
 
+    public static final NodeDef[] EMPTY_ARRAY = new NodeDef[0];
+
     /**
      * Returns an identifier for this node definition.
      *

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDef.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDef.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/PropDef.java Tue
May 24 10:03:06 2005
@@ -27,6 +27,8 @@
  */
 public interface PropDef extends ItemDef {
 
+    public static final PropDef[] EMPTY_ARRAY = new PropDef[0];
+
     /**
      * Returns an identifier for this property definition.
      *

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
Tue May 24 10:03:06 2005
@@ -245,13 +245,7 @@
             // multi- or single-valued property?
             if (tva.length == 1) {
                 // could be single- or multi-valued (n == 1)
-                try {
-                    // try single-valued
-                    def = ent.getApplicablePropertyDef(propName, type, false);
-                } catch (ConstraintViolationException cve) {
-                    // try multi-valued
-                    def = ent.getApplicablePropertyDef(propName, type, true);
-                }
+                def = ent.getApplicablePropertyDef(propName, type);
             } else {
                 // can only be multi-valued (n == 0 || n > 1)
                 def = ent.getApplicablePropertyDef(propName, type, true);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
Tue May 24 10:03:06 2005
@@ -492,15 +492,8 @@
                     // multi- or single-valued property?
                     if (tva.length == 1) {
                         // could be single- or multi-valued (n == 1)
-                        try {
-                            // try single-valued
-                            def = itemOps.findApplicablePropertyDefinition(propName,
-                                    type, false, node);
-                        } catch (ConstraintViolationException cve) {
-                            // try multi-valued
-                            def = itemOps.findApplicablePropertyDefinition(propName,
-                                    type, true, node);
-                        }
+                        def = itemOps.findApplicablePropertyDefinition(propName,
+                                type, node);
                     } else {
                         // can only be multi-valued (n == 0 || n > 1)
                         def = itemOps.findApplicablePropertyDefinition(propName,



Mime
View raw message