Skip to content

Commit 059a6fb

Browse files
Fix SubscriptionModeConverter to handle null and invalid values
1 parent 233ea48 commit 059a6fb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/SubscriptionModeConverter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ public class SubscriptionModeConverter implements Converter<String, Subscription
2525

2626
@Override
2727
public SubscriptionMode convert(String value) {
28-
return SubscriptionMode.valueOf(value);
28+
if(value==null || value.trim().isEmpty()){
29+
return null;
30+
}
31+
try{
32+
return SubscriptionMode.valueOf(value.trim().toUpperCase());
33+
}catch (IllegalArgumentException e ){
34+
return null;
35+
}
2936
}
3037

3138
@Override

0 commit comments

Comments
 (0)