Github user ddebrunner commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/33#discussion_r56983931
--- Diff:
connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/KeystorePath.java
---
@@ -5,22 +5,25 @@
package quarks.tests.connectors.wsclient.javax.websocket;
import java.io.File;
+import java.nio.file.Path;
public class KeystorePath {
public static String getStorePath(String storeLeaf) {
- String path = System.getProperty("user.dir");
+ String pathStr = System.getProperty("user.dir");
// Under eclipse/junit: path to project in repo: <repo>/connectors
// Under ant/junit:
<repo>/connectors/<project>/unittests/testrunxxxxxxx
- if (!path.endsWith("/connectors")) {
- int indx = path.indexOf("/connectors/");
- indx += "/connectors/".length() - 1;
- path = path.substring(0, indx);
- }
- path += "/wsclient-javax.websocket/src/test/keystores/" +
storeLeaf;
- if (!new File(path).exists())
+ // Get the path to the <repo>/connectors
+ Path path = new File(pathStr).toPath();
+ do {
+ if (path.endsWith("connectors"))
+ break;
+ path = path.getParent();
+ } while (path.getNameCount() > 0);
+ path = path.resolve("wsclient-javax.websocket/src/test/keystores/"
+ storeLeaf);
--- End diff --
Still, portable Java code should not assume '/' will work as a file
separator. File.separatorChar.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---