jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r155625 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Date Sun, 27 Feb 2005 14:19:16 GMT
Author: stefan
Date: Sun Feb 27 06:19:15 2005
New Revision: 155625

URL: http://svn.apache.org/viewcvs?view=rev&rev=155625
Log:
fixed bug in node type validation: added check that auto-create properties & child nodes
specify a type

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?view=diff&r1=155624&r2=155625
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Sun Feb 27 06:19:15 2005
@@ -572,6 +572,14 @@
                 log.debug(msg);
                 throw new InvalidNodeTypeDefException(msg);
             }
+            // check that auto-created properties specify a type
+            if (pd.getRequiredType() == PropertyType.UNDEFINED
+                    && pd.isAutoCreate()) {
+                String msg = "[" + name + "#" + pd.getName()
+                        + "] auto-created properties must specify a type";
+                log.debug(msg);
+                throw new InvalidNodeTypeDefException(msg);
+            }
             /**
              * check default values:
              * make sure type of value is consistent with required property type
@@ -673,6 +681,14 @@
             if (cnd.definesResidual() && cnd.isAutoCreate()) {
                 String msg = "[" + name + "#" + cnd.getName()
                         + "] auto-created child-nodes must specify a name";
+                log.debug(msg);
+                throw new InvalidNodeTypeDefException(msg);
+            }
+            // check that auto-created child-nodes specify a default primary type
+            if (cnd.getDefaultPrimaryType() == null
+                    && cnd.isAutoCreate()) {
+                String msg = "[" + name + "#" + cnd.getName()
+                        + "] auto-created child-nodes must specify a default primary type";
                 log.debug(msg);
                 throw new InvalidNodeTypeDefException(msg);
             }



Mime
View raw message