[NO ISSUE][STO] Platform Independent File Path Split
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Avoid regex while splitting file paths to
eliminate invalid regex on Windows platform.
Change-Id: Id3d6bae7e35b26c6fd5685757a7c13ea86811f14
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2391
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/ResourceReference.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/ResourceReference.java
index 52cf4a0..81d311d 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/ResourceReference.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/storage/ResourceReference.java
@@ -23,6 +23,7 @@
import java.nio.file.Paths;
import org.apache.asterix.common.utils.StorageConstants;
+import org.apache.commons.lang3.StringUtils;
public class ResourceReference {
@@ -77,7 +78,7 @@
protected static void parse(ResourceReference ref, String path) {
// format: root/partition/dataverse/dataset/rebalanceCount/index/fileName
- final String[] tokens = path.split(File.separator);
+ final String[] tokens = StringUtils.split(path, File.separatorChar);
if (tokens.length < 6) {
throw new IllegalStateException("Unrecognized path structure: " + path);
}