mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Don't return null if name is null by try to use UNDEFINED. Only if that is not present we return null
This commit is contained in:
parent
527f1537a9
commit
2b747cc323
@ -69,13 +69,10 @@ public class ProtoUtil {
|
||||
*/
|
||||
@Nullable
|
||||
public static <E extends Enum<E>> E enumFromProto(Class<E> enumType, String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
E result = Enums.getIfPresent(enumType, name).orNull();
|
||||
String enumName = name != null ? name : "UNDEFINED";
|
||||
E result = Enums.getIfPresent(enumType, enumName).orNull();
|
||||
if (result == null) {
|
||||
log.debug("Invalid value for enum " + enumType.getSimpleName() + ": " + name);
|
||||
log.debug("Invalid value for enum " + enumType.getSimpleName() + ": " + enumName);
|
||||
result = Enums.getIfPresent(enumType, "UNDEFINED").orNull();
|
||||
log.debug("We try to lookup for an enum entry with name 'UNDEFINED' and use that if available, " +
|
||||
"otherwise the enum is null. enum={}", result);
|
||||
|
Loading…
Reference in New Issue
Block a user