jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1330019 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
Date Tue, 24 Apr 2012 21:15:14 GMT
Author: mduerig
Date: Tue Apr 24 21:15:14 2012
New Revision: 1330019

URL: http://svn.apache.org/viewvc?rev=1330019&view=rev
Log:
OAK-68: Extension point for commit validation
check for empty local name

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java?rev=1330019&r1=1330018&r2=1330019&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java
Tue Apr 24 21:15:14 2012
@@ -36,15 +36,17 @@ class NameValidator implements Validator
         String local = name;
 
         int colon = name.indexOf(':');
+        if (colon == name.length() - 1) {
+            throw new CommitFailedException("Local name most not be empty");
+        }
         if (colon != -1) {
             prefix = name.substring(0, colon);
             local = name.substring(colon + 1);
         }
 
-        if (!(prefix == null || prefixes.contains(prefix))
+        if (!(prefix == null || !prefixes.contains(prefix))
                 || !isValidLocalName(local)) {
-            throw new CommitFailedException(
-                    "Self or parent paths (. or ..) are not valid as names");
+            throw new CommitFailedException("Invalid name: " + name);
         }
     }
 



Mime
View raw message