jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1384720 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type: NodeDefinitionTemplateImpl.java NodeTypeTemplateImpl.java
Date Fri, 14 Sep 2012 11:05:11 GMT
Author: mduerig
Date: Fri Sep 14 11:05:11 2012
New Revision: 1384720

URL: http://svn.apache.org/viewvc?rev=1384720&view=rev
Log:
OAK-66: JCR Node Type Management
more null checks

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java?rev=1384720&r1=1384719&r2=1384720&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
Fri Sep 14 11:05:11 2012
@@ -147,8 +147,13 @@ class NodeDefinitionTemplateImpl
 
     @Override
     public void setDefaultPrimaryTypeName(String name) throws ConstraintViolationException
{
-        JcrNameParser.checkName(name, false);
-        this.defaultPrimaryTypeName  = name;
+        if (name == null) {
+            this.defaultPrimaryTypeName = null;
+        }
+        else {
+            JcrNameParser.checkName(name, false);
+            this.defaultPrimaryTypeName = name;
+        }
     }
 
     @Override
@@ -183,6 +188,9 @@ class NodeDefinitionTemplateImpl
 
     @Override
     public void setRequiredPrimaryTypeNames(String[] names) throws ConstraintViolationException
{
+        if (names == null) {
+            throw new ConstraintViolationException("null is not a valid array of JCR names");
+        }
         for (String name : names) {
             JcrNameParser.checkName(name, false);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java?rev=1384720&r1=1384719&r2=1384720&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeTemplateImpl.java
Fri Sep 14 11:05:11 2012
@@ -208,8 +208,13 @@ final class NodeTypeTemplateImpl
 
     @Override
     public void setPrimaryItemName(String name) throws ConstraintViolationException {
-        JcrNameParser.checkName(name, false);
-        this.primaryItemName = name;
+        if (name == null) {
+            this.primaryItemName = null;
+        }
+        else {
+            JcrNameParser.checkName(name, false);
+            this.primaryItemName = name;
+        }
     }
 
     @Override
@@ -219,6 +224,9 @@ final class NodeTypeTemplateImpl
 
     @Override
     public void setDeclaredSuperTypeNames(String[] names) throws ConstraintViolationException
{
+        if (names == null) {
+            throw new ConstraintViolationException("null is not a valid array of JCR names");
+        }
         for (String name : names) {
             JcrNameParser.checkName(name, false);
         }



Mime
View raw message