Fix enum parsing from Config files
Change-Id: Ib0b86ceab070d46903de7b55f2fd441714855141
This commit is contained in:
parent
8a63474518
commit
5630686655
|
@ -290,6 +290,9 @@ public void testGetEnum() throws ConfigInvalidException {
|
|||
|
||||
c = parse("[s \"b\"]\n\tc = one-two\n");
|
||||
assertSame(TestEnum.ONE_TWO, c.getEnum("s", "b", "c", TestEnum.ONE_TWO));
|
||||
|
||||
c = parse("[s \"b\"]\n\tc = one two\n");
|
||||
assertSame(TestEnum.ONE_TWO, c.getEnum("s", "b", "c", TestEnum.ONE_TWO));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -387,7 +387,7 @@ public <T extends Enum<?>> T getEnum(final T[] all, final String section,
|
|||
if (value == null)
|
||||
return defaultValue;
|
||||
|
||||
String n = value.replace('-', '_');
|
||||
String n = value.replace('-', '_').replace(' ', '_');
|
||||
T trueState = null;
|
||||
T falseState = null;
|
||||
for (T e : all) {
|
||||
|
|
Loading…
Reference in New Issue