jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1525820 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Date Tue, 24 Sep 2013 09:07:14 GMT
Author: mduerig
Date: Tue Sep 24 09:07:14 2013
New Revision: 1525820

URL: http://svn.apache.org/r1525820
Log:
OAK-658: Unexpected illegal path handling on oak-jcr wrt backwards compatibility
Adapt test expectations since NamePathMapper returns null now for invalid paths

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java?rev=1525820&r1=1525819&r2=1525820&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
Tue Sep 24 09:07:14 2013
@@ -150,12 +150,10 @@ public class NamePathMapperImpl implemen
         // identifier path?
         if (length > 0 && jcrPath.charAt(0) == '[') {
             if (jcrPath.charAt(length - 1) != ']') {
-                // TODO error handling?
                 log.debug("Could not parse path " + jcrPath + ": unterminated identifier");
                 return null;
             }
             if (this.idManager == null) {
-                // TODO error handling?
                 log.debug("Could not parse path " + jcrPath + ": could not resolve identifier");
                 return null;
             }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java?rev=1525820&r1=1525819&r2=1525820&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Tue Sep 24 09:07:14 2013
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.namepa
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
@@ -28,7 +29,6 @@ import javax.jcr.RepositoryException;
 
 import com.google.common.collect.ImmutableMap;
 import org.apache.jackrabbit.oak.core.IdentifierManager;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class NamePathMapperImplTest {
@@ -47,7 +47,7 @@ public class NamePathMapperImplTest {
             "foo", "http://www.example.com/foo",
             "quu", "http://www.example.com/quu");
 
-    private NameMapper mapper = new LocalNameMapper() {
+    private final NameMapper mapper = new LocalNameMapper() {
         @Override
         protected Map<String, String> getNamespaceMap() {
             return GLOBAL;
@@ -62,7 +62,6 @@ public class NamePathMapperImplTest {
     private NamePathMapper npMapper = new NamePathMapperImpl(mapper);
 
     @Test
-    @Ignore("OAK-658")
     public void testInvalidIdentifierPath() {
         String uuid = IdentifierManager.generateUUID();
         List<String> invalid = new ArrayList<String>();
@@ -70,10 +69,7 @@ public class NamePathMapperImplTest {
         invalid.add('[' + uuid + "]/a/b/c");
 
         for (String jcrPath : invalid) {
-            try {
-                npMapper.getOakPath(jcrPath);
-                fail("Expected IllegalArgumentException for path: " + jcrPath);
-            } catch (IllegalArgumentException ignore) {}
+            assertNull(npMapper.getOakPath(jcrPath));
         }
     }
 
@@ -175,15 +171,11 @@ public class NamePathMapperImplTest {
     }
 
     @Test
-    @Ignore("OAK-658")
     public void testInvalidJcrPaths() {
         String[] paths = {"//", "/foo//", "/..//", "/..", "/foo/../.."};
 
         for (String path : paths) {
-            try {
-                npMapper.getOakPath(path);
-                fail("Expected IllegalArgumentException for path " + path);
-            } catch (IllegalArgumentException ignore) {}
+            assertNull(npMapper.getOakPath(path));
         }
     }
 



Mime
View raw message