tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [08/15] incubator-tinkerpop git commit: Url separator is always / even on windows
Date Mon, 22 Feb 2016 13:20:00 GMT
Url separator is always / even on windows


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/9d0c8770
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/9d0c8770
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/9d0c8770

Branch: refs/heads/master
Commit: 9d0c87707e828b2ff5dbf8ef3d60051deebb055d
Parents: 0715c4e
Author: Marvin Froeder <marvin.froeder@vizexplorer.com>
Authored: Mon Feb 1 13:15:33 2016 +1300
Committer: Marvin Froeder <marvin.froeder@vizexplorer.com>
Committed: Mon Feb 22 09:30:54 2016 +1300

----------------------------------------------------------------------
 .../java/org/apache/tinkerpop/gremlin/TestHelper.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9d0c8770/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
index 303b1e3..a3c252f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
@@ -32,6 +32,8 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Iterator;
 import java.util.List;
@@ -50,6 +52,7 @@ import static org.junit.Assert.assertFalse;
 public final class TestHelper {
 
     private static final String SEP = File.separator;
+    private static final char URL_SEP = '/';
     public static final String TEST_DATA_RELATIVE_DIR = "test-case-data";
 
     private TestHelper() {
@@ -105,9 +108,14 @@ public final class TestHelper {
     }
 
     private static String computePath(final Class clazz) {
-        final String clsUri = clazz.getName().replace('.', SEP.charAt(0)) + ".class";
+        final String clsUri = clazz.getName().replace('.', URL_SEP) + ".class";
         final URL url = clazz.getClassLoader().getResource(clsUri);
-        final String clsPath = url.getPath();
+        String clsPath;
+		try {
+			clsPath = new File(url.toURI()).getAbsolutePath();
+		} catch (URISyntaxException e) {
+			throw new RuntimeException("Unable to computePath for " + clazz, e);
+		}
         return clsPath.substring(0, clsPath.length() - clsUri.length());
     }
 


Mime
View raw message