Repository: jclouds
Updated Branches:
  refs/heads/master 4ecb07809 -> a697396e8


Correctly remove prefix in DelimiterFilter

Previously this called String.replaceFirst which uses a regular
expression and incorrectly handles characters like *.  Also remove
other correct but unnecessary call to String.replaceFirst.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a697396e
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a697396e
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a697396e

Branch: refs/heads/master
Commit: a697396e8c87e30e7deb1aa9f7865e5b34a4c25f
Parents: 4ecb078
Author: Andrew Gaul <[email protected]>
Authored: Tue Feb 9 10:43:12 2016 -0800
Committer: Andrew Gaul <[email protected]>
Committed: Tue Feb 9 10:48:01 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/jclouds/blobstore/config/LocalBlobStore.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/a697396e/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
----------------------------------------------------------------------
diff --git 
a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java 
b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
index ce244ef..a5f3406 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
@@ -39,7 +39,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.UUID;
-import java.util.regex.Pattern;
 
 import javax.annotation.Resource;
 import javax.inject.Inject;
@@ -473,7 +472,7 @@ public final class LocalBlobStore implements BlobStore {
             return name.indexOf(delimiter) == -1;
          }
          if (name.startsWith(prefix)) {
-            String unprefixedName = name.replaceFirst(prefix, "");
+            String unprefixedName = name.substring(prefix.length());
             if (unprefixedName.equals("")) {
                // a blob that matches the prefix should also be returned
                return true;
@@ -498,7 +497,7 @@ public final class LocalBlobStore implements BlobStore {
          String working = metadata.getName();
          if (prefix != null) {
             if (working.startsWith(prefix)) {
-               working = working.replaceFirst(Pattern.quote(prefix), "");
+               working = working.substring(prefix.length());
             } else {
                return NO_PREFIX;
             }

Reply via email to