Skip to content

Commit c977b79

Browse files
author
Lavkesh Lahngir
committed
Handle No enum constant RuntimeException
1 parent 4fa2c9b commit c977b79

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

serving/src/main/java/feast/serving/configuration/redis/JobStoreRedisConfig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package feast.serving.configuration.redis;
1818

19+
import com.google.common.base.Enums;
1920
import feast.core.StoreProto;
2021
import feast.serving.FeastProperties;
2122
import io.lettuce.core.RedisClient;
@@ -40,8 +41,11 @@ ClientResources jobStoreClientResources() {
4041
@Bean(destroyMethod = "shutdown")
4142
RedisClient jobStoreRedisClient(
4243
ClientResources jobStoreClientResources, FeastProperties feastProperties) {
43-
if (StoreProto.Store.StoreType.valueOf(feastProperties.getJobs().getStoreType())
44-
!= StoreProto.Store.StoreType.REDIS) return null;
44+
StoreProto.Store.StoreType storeType =
45+
Enums.getIfPresent(
46+
StoreProto.Store.StoreType.class, feastProperties.getJobs().getStoreType())
47+
.orNull();
48+
if (storeType != StoreProto.Store.StoreType.REDIS) return null;
4549
Map<String, String> jobStoreConf = feastProperties.getJobs().getStoreOptions();
4650
// If job conf is empty throw StoreException
4751
if (jobStoreConf == null

0 commit comments

Comments
 (0)