Fix parsing enum
should parse enum after capitalizing property value.
Bug: 80125326
Test: mma -j && sysprop_test && run Settings robo test
Change-Id: If084902c4bdbf5eb4aa0649b0faa0c31b6ef953c
diff --git a/JavaGen.cpp b/JavaGen.cpp
index f95196c..c11c3d1 100644
--- a/JavaGen.cpp
+++ b/JavaGen.cpp
@@ -90,7 +90,7 @@
private static <T extends Enum<T>> T tryParseEnum(Class<T> enumType, String str) {
try {
- return Enum.valueOf(enumType, str);
+ return Enum.valueOf(enumType, str.toUpperCase());
} catch (IllegalArgumentException e) {
return null;
}
diff --git a/tests/JavaGenTest.cpp b/tests/JavaGenTest.cpp
index 1b04973..6c5de8d 100644
--- a/tests/JavaGenTest.cpp
+++ b/tests/JavaGenTest.cpp
@@ -161,7 +161,7 @@
private static <T extends Enum<T>> T tryParseEnum(Class<T> enumType, String str) {
try {
- return Enum.valueOf(enumType, str);
+ return Enum.valueOf(enumType, str.toUpperCase());
} catch (IllegalArgumentException e) {
return null;
}