diff options
author | ejdhzopu <ejdhzopu@gmail.com> | 2018-10-16 18:08:17 -0700 |
---|---|---|
committer | ejdhzopu <ejdhzopu@gmail.com> | 2018-10-16 18:08:17 -0700 |
commit | 4386bced9fb8fcea97bf95cede09ae0babca9ed0 (patch) | |
tree | 5946f903bfe08a4bfa2a52c2d4e61319ba4d85ed /config-model | |
parent | 148a160f98556c5d50cf2411db47b7ce3f548038 (diff) |
Fix BinaryUnit not checking if the input matches the expected pattern
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/BinaryUnit.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/BinaryUnit.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/BinaryUnit.java index d953d072087..b30f44bfdb1 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/BinaryUnit.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/BinaryUnit.java @@ -16,7 +16,9 @@ public class BinaryUnit { public static double valueOf(String valueString) { Matcher matcher = pattern.matcher(valueString); - matcher.matches(); + if (!matcher.matches()) { + throw new IllegalArgumentException("Value '" + valueString + "' does not match the pattern for binary unit"); + } double value = Double.valueOf(matcher.group(1)); String unit = matcher.group(3); if (unit != null) { |