jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1805053 - in /jackrabbit/commons/filevault/trunk/vault-core/src: main/java/org/apache/jackrabbit/vault/fs/api/ test/java/org/apache/jackrabbit/vault/fs/api/
Date Tue, 15 Aug 2017 05:26:53 GMT
Author: tripod
Date: Tue Aug 15 05:26:53 2017
New Revision: 1805053

URL: http://svn.apache.org/viewvc?rev=1805053&view=rev
Log:
JCRVLT-196 Add remapping support for other than renames

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/RegexpPathMapping.java
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/package-info.java
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/api/PathMappingTest.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/RegexpPathMapping.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/RegexpPathMapping.java?rev=1805053&r1=1805052&r2=1805053&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/RegexpPathMapping.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/RegexpPathMapping.java
Tue Aug 15 05:26:53 2017
@@ -43,6 +43,7 @@ public final class RegexpPathMapping imp
      * @param pathsMappingMap the data structure containing the mapping
      * @return this
      */
+    @Nonnull
     public <K, V> RegexpPathMapping addAllMappings(@Nonnull Map<K, V> pathsMappingMap)
{
         for (Entry<K, V> entry : pathsMappingMap.entrySet()) {
             final K key = entry.getKey();
@@ -87,7 +88,13 @@ public final class RegexpPathMapping imp
     @Override
     @Nonnull
     public String map(@Nonnull String path) {
-        return map(path, false);
+        for (Entry<Pattern, String> pathMapping : pathsMapping.entrySet()) {
+            Matcher matcher = pathMapping.getKey().matcher(path);
+            if (matcher.matches()) {
+                return matcher.replaceAll(pathMapping.getValue());
+            }
+        }
+        return path;
     }
 
     /**
@@ -97,16 +104,9 @@ public final class RegexpPathMapping imp
     @Nonnull
     public String map(@Nonnull String path, boolean reverse) {
         if (reverse) {
-            throw new IllegalArgumentException("path mapping cannot be reversed with the
regexp mapping");
-        } else {
-            for (Entry<Pattern, String> pathMapping : pathsMapping.entrySet()) {
-                Matcher matcher = pathMapping.getKey().matcher(path);
-                if (matcher.matches()) {
-                    return matcher.replaceAll(pathMapping.getValue());
-                }
-            }
-            return path;
+            throw new IllegalArgumentException("No reverse mapping not supported with regexp
mapping");
         }
+        return map(path);
     }
 
 }

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/package-info.java?rev=1805053&r1=1805052&r2=1805053&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/package-info.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/package-info.java
Tue Aug 15 05:26:53 2017
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@Version("2.5.0")
+@Version("2.5.1")
 package org.apache.jackrabbit.vault.fs.api;
 
 import org.osgi.annotation.versioning.Version;
\ No newline at end of file

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/api/PathMappingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/api/PathMappingTest.java?rev=1805053&r1=1805052&r2=1805053&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/api/PathMappingTest.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/api/PathMappingTest.java
Tue Aug 15 05:26:53 2017
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.vault.fs.api;
 
-import static org.junit.Assert.assertEquals;
-
 import org.junit.Test;
 
 import static junit.framework.Assert.assertEquals;



Mime
View raw message