Allow time unit variables to be 0
plugins.checkFrequency can be disabled by setting the time to 0, but this is not allowed in a time unit typed variable due to the regex requiring the value to start with a digit in the range 1-9. Permit 0 as a value. Change-Id: I2deca08fe9b0ea93ef23f626fc44cffe98ad2d95
This commit is contained in:
@@ -228,7 +228,7 @@ public class ConfigUtil {
|
||||
*/
|
||||
public static long getTimeUnit(final String valueString, long defaultValue,
|
||||
TimeUnit wantUnit) {
|
||||
Matcher m = Pattern.compile("^([1-9][0-9]*)\\s*(.*)$").matcher(valueString);
|
||||
Matcher m = Pattern.compile("^(0|[1-9][0-9]*)\\s*(.*)$").matcher(valueString);
|
||||
if (!m.matches()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user