Don't throw exception in if else

pull/1470/head
MZR 2 years ago
parent a5d01f8ea8
commit 234df3c3ee

@ -153,7 +153,11 @@ public class BeforeCheckConfiguration {
"Web server maybe fail to start. The dynamic thread pool polaris namespace is empty.", "Web server maybe fail to start. The dynamic thread pool polaris namespace is empty.",
"Please check whether the [spring.dynamic.thread-pool.polaris.namespace] configuration is empty or an empty string."); "Please check whether the [spring.dynamic.thread-pool.polaris.namespace] configuration is empty or an empty string.");
} }
if (polaris.get("file") instanceof Map) { if (!(polaris.get("file") instanceof Map)) {
throw new ConfigEmptyException(
"Web server maybe fail to start. Lack of the dynamic thread pool polaris file configuration.",
"Please check whether the [spring.dynamic.thread-pool.polaris.file.*] configuration is complete.");
}
Map<String, String> polarisFile = (Map<String, String>) polaris.get("file"); Map<String, String> polarisFile = (Map<String, String>) polaris.get("file");
String fileGroup = polarisFile.get("group"); String fileGroup = polarisFile.get("group");
if (StringUtil.isBlank(fileGroup)) { if (StringUtil.isBlank(fileGroup)) {
@ -173,11 +177,6 @@ public class BeforeCheckConfiguration {
"Web server maybe fail to start. The dynamic thread pool polaris file type is empty.", "Web server maybe fail to start. The dynamic thread pool polaris file type is empty.",
"Please check whether the [spring.dynamic.thread-pool.polaris.file.type] configuration is empty or an empty string."); "Please check whether the [spring.dynamic.thread-pool.polaris.file.type] configuration is empty or an empty string.");
} }
} else {
throw new ConfigEmptyException(
"Web server maybe fail to start. Lack of the dynamic thread pool polaris file configuration.",
"Please check whether the [spring.dynamic.thread-pool.polaris.file.*] configuration is complete.");
}
} }
break; break;
} }

Loading…
Cancel
Save