jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r786685 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java
Date Fri, 19 Jun 2009 22:02:27 GMT
Author: tripod
Date: Fri Jun 19 22:02:26 2009
New Revision: 786685

URL: http://svn.apache.org/viewvc?rev=786685&view=rev
Log:
Cope with NULL names

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java?rev=786685&r1=786684&r2=786685&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.java
Fri Jun 19 22:02:26 2009
@@ -95,12 +95,12 @@
     public NodeTypeDefinition create(QNodeTypeDefinition qNtd)
             throws RepositoryException {
         NodeTypeTemplate nt = ntMgr.createNodeTypeTemplate();
-        nt.setName(resolver.getJCRName(qNtd.getName()));
+        nt.setName(getJCRName(qNtd.getName()));
         nt.setDeclaredSuperTypeNames(getJCRNames(qNtd.getSupertypes()));
         nt.setAbstract(qNtd.isAbstract());
         nt.setMixin(qNtd.isMixin());
         nt.setOrderableChildNodes(qNtd.hasOrderableChildNodes());
-        nt.setPrimaryItemName(resolver.getJCRName(qNtd.getPrimaryItemName()));
+        nt.setPrimaryItemName(getJCRName(qNtd.getPrimaryItemName()));
         nt.setQueryable(qNtd.isQueryable());
         List nodeDefs = nt.getNodeDefinitionTemplates();
         for (QNodeDefinition qNd: qNtd.getChildNodeDefs()) {
@@ -123,13 +123,13 @@
     public NodeDefinition create(QNodeDefinition qNd)
             throws RepositoryException {
         NodeDefinitionTemplate nt = ntMgr.createNodeDefinitionTemplate();
-        nt.setName(resolver.getJCRName(qNd.getName()));
+        nt.setName(getJCRName(qNd.getName()));
         nt.setAutoCreated(qNd.isAutoCreated());
         nt.setMandatory(qNd.isMandatory());
         nt.setOnParentVersion(qNd.getOnParentVersion());
         nt.setProtected(qNd.isProtected());
         nt.setSameNameSiblings(qNd.allowsSameNameSiblings());
-        nt.setDefaultPrimaryTypeName(resolver.getJCRName(qNd.getDefaultPrimaryType()));
+        nt.setDefaultPrimaryTypeName(getJCRName(qNd.getDefaultPrimaryType()));
         nt.setRequiredPrimaryTypeNames(getJCRNames(qNd.getRequiredPrimaryTypes()));
         return nt;
     }
@@ -143,7 +143,7 @@
      */
     public PropertyDefinition create(QPropertyDefinition qPd) throws RepositoryException
{
         PropertyDefinitionTemplate pt = ntMgr.createPropertyDefinitionTemplate();
-        pt.setName(resolver.getJCRName(qPd.getName()));
+        pt.setName(getJCRName(qPd.getName()));
         pt.setAutoCreated(qPd.isAutoCreated());
         pt.setMandatory(qPd.isMandatory());
         pt.setOnParentVersion(qPd.getOnParentVersion());
@@ -157,6 +157,9 @@
     }
 
     private String[] getJCRNames(Name[] names) throws NamespaceException {
+        if (names == null) {
+            return null;
+        }
         String[] ret = new String[names.length];
         for (int i=0; i<names.length; i++) {
             ret[i] = resolver.getJCRName(names[i]);
@@ -164,6 +167,13 @@
         return ret;
     }
 
+    private String getJCRName(Name name) throws NamespaceException {
+        if (name == null) {
+            return null;
+        }
+        return resolver.getJCRName(name);
+    }
+
     private String[] createValueConstraints(int type, QValueConstraint[] qv)
             throws RepositoryException {
         String[] ret = new String[qv.length];
@@ -179,6 +189,9 @@
     }
 
     private Value[] createValues(QValue[] qv) {
+        if (qv == null){
+            return null;
+        }
         Value[] ret = new Value[qv.length];
         for (int i=0; i<ret.length; i++) {
             ret[i] = new QValueValue(qv[i], resolver);



Mime
View raw message