jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r390670 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
Date Sat, 01 Apr 2006 13:54:42 GMT
Author: jukka
Date: Sat Apr  1 05:54:39 2006
New Revision: 390670

URL: http://svn.apache.org/viewcvs?rev=390670&view=rev
Log:
JCR-369: Restored support for multiple mixin types per node in document view import.

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=390670&r1=390669&r2=390670&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
Sat Apr  1 05:54:39 2006
@@ -202,20 +202,7 @@
                     }
                 } else if (propName.equals(QName.JCR_MIXINTYPES)) {
                     // jcr:mixinTypes
-                    if (propValues.length > 0) {
-                        mixinTypes = new QName[propValues.length];
-                        for (int j = 0; j < propValues.length; j++) {
-                            Value value = 
-                                propValues[j].getValue(PropertyType.NAME, nsContext);
-                            try {
-                                mixinTypes[j] =
-                                    QName.fromJCRName(value.getString(), nsContext);
-                            } catch (NameException ne) {
-                                throw new SAXException("illegal jcr:mixinTypes value: "
-                                        + value.getString(), ne);
-                            }
-                        }
-                    }
+                    mixinTypes = parseNames(attrValue);
                 } else if (propName.equals(QName.JCR_UUID)) {
                     // jcr:uuid
                     if (attrValue.length() > 0) {
@@ -236,6 +223,29 @@
         } catch (RepositoryException re) {
             throw new SAXException(re);
         }
+    }
+
+    /**
+     * Parses the given string as a list of JCR names. Any whitespace sequence
+     * is supported as a names separator instead of just a single space to
+     * be more liberal in what we accept. The current namespace context is
+     * used to convert the prefixed name strings to QNames.
+     *
+     * @param value string value
+     * @return the parsed names
+     * @throws SAXException if an invalid name was encountered
+     */
+    private QName[] parseNames(String value) throws SAXException {
+        String[] names = value.split("\\p{Space}+");
+        QName[] qnames = new QName[names.length];
+        for (int i = 0; i < names.length; i++) {
+            try {
+                qnames[i] = nsContext.getQName(names[i]);
+            } catch (NameException ne) {
+                throw new SAXException("Invalid name: " + names[i], ne);
+            }
+        }
+        return qnames;
     }
 
     /**



Mime
View raw message