Permalink
Browse files

better base-path handling of slash character. Closses issue #157

  • Loading branch information...
1 parent 581f7af commit 5da05fb621b8fa466cf424c284d0df548d99f2d2 @zznate committed Mar 8, 2013
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/main/java/org/usergrid/vx/server/IntravertDeamon.java
@@ -15,7 +15,10 @@
*/
package org.usergrid.vx.server;
+import com.google.common.base.CharMatcher;
+import com.google.common.base.Preconditions;
import org.apache.cassandra.service.CassandraDaemon;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +38,8 @@ public static void main(String[] args) {
System.setProperty("cassandra-foreground", "true");
System.setProperty("log4j.defaultInitOverride", "true");
System.setProperty("log4j.configuration", "log4j.properties");
- basePath = System.getProperty("basePath",DEF_BASE_PATH);
+
+ createBasePath();
instance.activate();
}
@@ -62,5 +66,18 @@ public void stop() {
intravertServer.stop();
}
+ /**
+ * check for a pre-configured basePath, reset to empty string if we are just a
+ * slash or spaces.
+ *
+ * @return
+ */
+ private static String createBasePath() {
+ basePath = System.getProperty("basePath",DEF_BASE_PATH);
+ if (StringUtils.isBlank(basePath) || StringUtils.equals(basePath, "/") ) {
+ basePath = StringUtils.EMPTY;
+ }
+ return basePath;
+ }
}

0 comments on commit 5da05fb

Please sign in to comment.