fix error message
This commit is contained in:
parent
2eecb9c02d
commit
cb0ea70b9d
|
@ -37,13 +37,13 @@ final class AutoExpandReplicas {
|
|||
}
|
||||
final int dash = value.indexOf('-');
|
||||
if (-1 == dash) {
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] form [" + value + "] at index " + dash);
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash);
|
||||
}
|
||||
final String sMin = value.substring(0, dash);
|
||||
try {
|
||||
min = Integer.parseInt(sMin);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] form [" + value + "] at index " + dash, e);
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash, e);
|
||||
}
|
||||
String sMax = value.substring(dash + 1);
|
||||
if (sMax.equals(ALL_NODES_VALUE)) {
|
||||
|
@ -52,7 +52,7 @@ final class AutoExpandReplicas {
|
|||
try {
|
||||
max = Integer.parseInt(sMax);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] form [" + value + "] at index " + dash, e);
|
||||
throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash, e);
|
||||
}
|
||||
}
|
||||
return new AutoExpandReplicas(min, max, true);
|
||||
|
|
|
@ -46,14 +46,14 @@ public class AutoExpandReplicasTests extends ESTestCase {
|
|||
AutoExpandReplicas.SETTING.get(Settings.builder().put("index.auto_expand_replicas", "boom").build());
|
||||
fail();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] form [boom] at index -1", ex.getMessage());
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] from value: [boom] at index -1", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
AutoExpandReplicas.SETTING.get(Settings.builder().put("index.auto_expand_replicas", "1-boom").build());
|
||||
fail();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] form [1-boom] at index 1", ex.getMessage());
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] from value: [1-boom] at index 1", ex.getMessage());
|
||||
assertEquals("For input string: \"boom\"", ex.getCause().getMessage());
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class AutoExpandReplicasTests extends ESTestCase {
|
|||
AutoExpandReplicas.SETTING.get(Settings.builder().put("index.auto_expand_replicas", "boom-1").build());
|
||||
fail();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] form [boom-1] at index 4", ex.getMessage());
|
||||
assertEquals("failed to parse [index.auto_expand_replicas] from value: [boom-1] at index 4", ex.getMessage());
|
||||
assertEquals("For input string: \"boom\"", ex.getCause().getMessage());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue