jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1330421 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Date Wed, 25 Apr 2012 17:06:44 GMT
Author: angela
Date: Wed Apr 25 17:06:44 2012
New Revision: 1330421

URL: http://svn.apache.org/viewvc?rev=1330421&view=rev
Log:
user JcrConstants instead of hardcoded property names, add TODO regarding exception handling

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java?rev=1330421&r1=1330420&r2=1330421&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Wed Apr 25 17:06:44 2012
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.plugin
 import java.util.Collections;
 import java.util.Set;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
@@ -36,14 +37,15 @@ class TypeValidator implements Validator
     private void checkTypeExists(PropertyState after)
             throws CommitFailedException {
         Iterable<CoreValue> coreValues = Collections.emptyList();
-        if ("jcr:primaryType".equals(after.getName())) {
+        if (JcrConstants.JCR_PRIMARYTYPE.equals(after.getName())) {
             coreValues = Collections.singletonList(after.getValue());
-        } else if ("jcr:mixinTypes".equals(after.getName())) {
+        } else if (JcrConstants.JCR_MIXINTYPES.equals(after.getName())) {
             coreValues = after.getValues();
         }
         for (CoreValue cv : coreValues) {
             String value = cv.getString();
             if (!types.contains(value)) {
+                // TODO: make sure NodeSuchNodeTypeException can be extracted in oak-jcr
                 throw new CommitFailedException("Unknown node type: " + value);
             }
         }



Mime
View raw message