This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 3191c91 fix some yellow alert in shenyu-admin module (#2355)
3191c91 is described below
commit 3191c9164e6d6e04f86406ae8afac903766c243e
Author: 飞鸿雪泥 <[email protected]>
AuthorDate: Mon Nov 15 14:40:55 2021 +0800
fix some yellow alert in shenyu-admin module (#2355)
---
.../java/org/apache/shenyu/admin/exception/ExceptionHandlers.java | 5 +++--
.../java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java | 2 +-
.../admin/service/converter/SelectorHandleConverterFactor.java | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
index 8479765..aab3fa4 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
@@ -36,6 +36,7 @@ import
org.springframework.web.method.annotation.MethodArgumentTypeMismatchExcep
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -89,7 +90,7 @@ public class ExceptionHandlers {
sb.append(e.getMethod());
sb.append(
" method is not supported for this request. Supported methods
are ");
- e.getSupportedHttpMethods().forEach(t -> sb.append(t + " "));
+ Objects.requireNonNull(e.getSupportedHttpMethods()).forEach(t ->
sb.append(t).append(" "));
return ShenyuAdminResult.error(sb.toString());
}
@@ -112,7 +113,7 @@ public class ExceptionHandlers {
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
protected ShenyuAdminResult
handleMethodArgumentTypeMismatchException(final
MethodArgumentTypeMismatchException e) {
LOG.warn("method argument type mismatch", e);
- return ShenyuAdminResult.error(String.format("%s should be of type
%s", e.getName(), e.getRequiredType().getName()));
+ return ShenyuAdminResult.error(String.format("%s should be of type
%s", e.getName(), Objects.requireNonNull(e.getRequiredType()).getName()));
}
@ExceptionHandler(ConstraintViolationException.class)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
index 8dd0037..89a25bf 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
@@ -41,7 +41,7 @@ public class EtcdDataInit implements CommandLineRunner {
}
@Override
- public void run(final String... args) throws Exception {
+ public void run(final String... args) {
final String pluginPath = DefaultPathConstants.PLUGIN_PARENT;
final String authPath = DefaultPathConstants.APP_AUTH_PARENT;
final String metaDataPath = DefaultPathConstants.META_DATA;
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/SelectorHandleConverterFactor.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/SelectorHandleConverterFactor.java
index bec96da..273577d 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/SelectorHandleConverterFactor.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/SelectorHandleConverterFactor.java
@@ -24,7 +24,7 @@ import java.util.Map;
*/
public class SelectorHandleConverterFactor {
- private Map<String, SelectorHandleConverter> maps;
+ private final Map<String, SelectorHandleConverter> maps;
/**
* Instantiates a new Selector handle converter factor.