diff --git a/pom.xml b/pom.xml
index eb871e12d..c80f06c8a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.baidu.hugegraph
hugegraph-common
- 1.3.10-SNAPSHOT
+ 1.3.11-SNAPSHOT
@@ -156,7 +156,7 @@
- 1.3.9.0
+ 1.3.11.0
diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java
index 9241418d3..2bc993fe7 100644
--- a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java
+++ b/src/main/java/com/baidu/hugegraph/config/ConfigOption.java
@@ -63,6 +63,10 @@ public class ConfigOption {
private final T defaultValue;
private final Predicate checkFunc;
+ public ConfigOption(String name, String desc, T value) {
+ this(name, desc, null, value);
+ }
+
@SuppressWarnings("unchecked")
public ConfigOption(String name, String desc, Predicate func, T value) {
this(name, false, desc, func, (Class) value.getClass(), value);
@@ -81,9 +85,7 @@ public class ConfigOption {
this.desc = desc;
this.checkFunc = func;
- if (this.checkFunc != null) {
- check(this.defaultValue);
- }
+ this.check(this.defaultValue);
}
private Class> checkAndAssignDataType(Class dataType) {
@@ -150,10 +152,12 @@ public class ConfigOption {
E.checkArgument(this.dataType.isInstance(value),
"Invalid type of value '%s' for option '%s'",
value, this.name);
- @SuppressWarnings("unchecked")
- T result = (T) value;
- E.checkArgument(this.checkFunc.apply(result),
- "Invalid option value for '%s': %s",
- this.name, value);
+ if (this.checkFunc != null) {
+ @SuppressWarnings("unchecked")
+ T result = (T) value;
+ E.checkArgument(this.checkFunc.apply(result),
+ "Invalid option value for '%s': %s",
+ this.name, value);
+ }
}
}