Skip to content

Commit

Permalink
fixed version selection for 2.2-rule/cost
Browse files Browse the repository at this point in the history
  • Loading branch information
jexp committed Dec 5, 2014
1 parent 2470fee commit bfe0c16
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/org/neo4j/community/console/Neo4jService.java
Expand Up @@ -19,6 +19,7 @@
class Neo4jService {

private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(Neo4jService.class);
public static final String VERSION_REGEXP = "(\\d+\\.\\d+(?:\\.experimental|-cost|-rule)?)";

private GraphDatabaseService gdb;

Expand Down Expand Up @@ -144,12 +145,16 @@ public String getVersion() {
public void setVersion(String version) {
if (version==null || version.trim().isEmpty()) this.version=null;
else {
version = version.replaceAll("^(\\d+\\.\\d+(?:\\.experimental|-cost|-rule)?).*","$1");
if (!version.matches("\\d+\\.\\d+(?:\\.experimental)?")) throw new IllegalArgumentException("Incorrect version string "+version);
this.version = version;
this.version = checkVersion(version);
}
}

public static String checkVersion(String version) {
version = version.replaceAll("^"+VERSION_REGEXP+".*","$1");
if (!version.matches(VERSION_REGEXP)) throw new IllegalArgumentException("Incorrect version string "+version);
return version;
}

public boolean isMutatingQuery(String query) {
return cypherQueryExecutor.isMutatingQuery(query);
}
Expand Down

0 comments on commit bfe0c16

Please sign in to comment.