You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/02/20 02:35:53 UTC
[dubbo] branch master updated: merge same catch branches (#7222)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 01bf745 merge same catch branches (#7222)
01bf745 is described below
commit 01bf7452c986fd768850697177e26625dfa806c0
Author: XenoAmess <xe...@gmail.com>
AuthorDate: Sat Feb 20 10:35:37 2021 +0800
merge same catch branches (#7222)
---
.../org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java | 2 --
.../rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java | 8 +-------
.../java/org/apache/dubbo/common/bytecode/ClassGenerator.java | 4 +---
.../org/apache/dubbo/common/compiler/support/ClassUtils.java | 4 +---
.../src/main/java/org/apache/dubbo/common/json/J2oVisitor.java | 8 ++------
.../java/org/apache/dubbo/common/utils/CollectionUtils.java | 4 +---
.../main/java/org/apache/dubbo/common/utils/ExecutorUtil.java | 8 ++------
.../src/main/java/org/apache/dubbo/common/utils/PojoUtils.java | 6 +-----
.../com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java | 10 ++--------
.../metadata/store/failover/FailoverMetadataReportTest.java | 3 +--
.../org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java | 4 +---
11 files changed, 13 insertions(+), 48 deletions(-)
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
index 77429b5..a00ec95 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java
@@ -227,8 +227,6 @@ public class TagRouter extends AbstractRouter implements ConfigurationListener {
if ((ANYHOST_VALUE + ":" + port).equals(address)) {
return true;
}
- } catch (UnknownHostException e) {
- logger.error("The format of ip address is invalid in tag route. Address :" + address, e);
} catch (Exception e) {
logger.error("The format of ip address is invalid in tag route. Address :" + address, e);
}
diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java
index 8d77aa4..bb6260c 100644
--- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java
+++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java
@@ -131,13 +131,7 @@ public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest {
recycleTimeField = RoundRobinLoadBalance.class.getDeclaredField("RECYCLE_PERIOD");
recycleTimeField.setAccessible(true);
recycleTimeField.setInt(RoundRobinLoadBalance.class, 10);
- } catch (NoSuchFieldException e) {
- Assertions.assertTrue(true, "getField failed");
- } catch (SecurityException e) {
- Assertions.assertTrue(true, "getField failed");
- } catch (IllegalArgumentException e) {
- Assertions.assertTrue(true, "getField failed");
- } catch (IllegalAccessException e) {
+ } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException | SecurityException e) {
Assertions.assertTrue(true, "getField failed");
}
}
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java
index b81b7a3..252c3aa 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java
@@ -340,9 +340,7 @@ public final class ClassGenerator {
return mCtc.toClass(loader, pd);
} catch (RuntimeException e) {
throw e;
- } catch (NotFoundException e) {
- throw new RuntimeException(e.getMessage(), e);
- } catch (CannotCompileException e) {
+ } catch (NotFoundException | CannotCompileException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java
index 365cb7f..0406dfb 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java
@@ -49,9 +49,7 @@ public class ClassUtils {
public static Object newInstance(String name) {
try {
return forName(name).newInstance();
- } catch (InstantiationException e) {
- throw new IllegalStateException(e.getMessage(), e);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/json/J2oVisitor.java b/dubbo-common/src/main/java/org/apache/dubbo/common/json/J2oVisitor.java
index 3aa3fd9..bc6e4e3 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/json/J2oVisitor.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/json/J2oVisitor.java
@@ -259,9 +259,7 @@ class J2oVisitor implements JSONVisitor {
try {
mValue = mType.newInstance();
mWrapper = Wrapper.getWrapper(mType);
- } catch (IllegalAccessException e) {
- throw new ParseException(StringUtils.toString(e));
- } catch (InstantiationException e) {
+ } catch (IllegalAccessException | InstantiationException e) {
throw new ParseException(StringUtils.toString(e));
}
}
@@ -304,9 +302,7 @@ class J2oVisitor implements JSONVisitor {
field.setAccessible(true);
}
field.set(mValue, obj);
- } catch (NoSuchFieldException e) {
- throw new ParseException(StringUtils.toString(e));
- } catch (IllegalAccessException e) {
+ } catch (NoSuchFieldException | IllegalAccessException e) {
throw new ParseException(StringUtils.toString(e));
}
} else if (!CLASS_PROPERTY.equals(name)) {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
index 1b73370..8f16036 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
@@ -324,9 +324,7 @@ public class CollectionUtils {
try {
return one.containsAll(another);
- } catch (ClassCastException unused) {
- return false;
- } catch (NullPointerException unused) {
+ } catch (ClassCastException | NullPointerException unused) {
return false;
}
}
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java
index 93a2a60..97f13a5 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java
@@ -60,9 +60,7 @@ public class ExecutorUtil {
try {
// Disable new tasks from being submitted
es.shutdown();
- } catch (SecurityException ex2) {
- return;
- } catch (NullPointerException ex2) {
+ } catch (SecurityException | NullPointerException ex2) {
return;
}
try {
@@ -86,9 +84,7 @@ public class ExecutorUtil {
final ExecutorService es = (ExecutorService) executor;
try {
es.shutdownNow();
- } catch (SecurityException ex2) {
- return;
- } catch (NullPointerException ex2) {
+ } catch (SecurityException | NullPointerException ex2) {
return;
}
try {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
index 28cf633..4514dc8 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PojoUtils.java
@@ -587,11 +587,7 @@ public class PojoUtils {
constructor.setAccessible(true);
Object[] parameters = Arrays.stream(constructor.getParameterTypes()).map(PojoUtils::getDefaultValue).toArray();
return constructor.newInstance(parameters);
- } catch (InstantiationException e) {
- throw new RuntimeException(e.getMessage(), e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.getMessage(), e);
- } catch (InvocationTargetException e) {
+ } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java
index 29cc14a..b2bba70 100644
--- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java
+++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/FutureAdapter.java
@@ -66,9 +66,7 @@ public class FutureAdapter<V> implements Future<V> {
public Object get() throws RemotingException {
try {
return future.get();
- } catch (InterruptedException e) {
- throw new RemotingException(e);
- } catch (ExecutionException e) {
+ } catch (InterruptedException | ExecutionException e) {
throw new RemotingException(e);
}
}
@@ -77,11 +75,7 @@ public class FutureAdapter<V> implements Future<V> {
public Object get(int timeoutInMillis) throws RemotingException {
try {
return future.get(timeoutInMillis, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- throw new RemotingException(e);
- } catch (ExecutionException e) {
- throw new RemotingException(e);
- } catch (TimeoutException e) {
+ } catch (InterruptedException | TimeoutException | ExecutionException e) {
throw new RemotingException(e);
}
}
diff --git a/dubbo-metadata/dubbo-metadata-report-failover/src/test/java/org/apache/dubbo/metadata/store/failover/FailoverMetadataReportTest.java b/dubbo-metadata/dubbo-metadata-report-failover/src/test/java/org/apache/dubbo/metadata/store/failover/FailoverMetadataReportTest.java
index 8cc7253..c7e50a8 100644
--- a/dubbo-metadata/dubbo-metadata-report-failover/src/test/java/org/apache/dubbo/metadata/store/failover/FailoverMetadataReportTest.java
+++ b/dubbo-metadata/dubbo-metadata-report-failover/src/test/java/org/apache/dubbo/metadata/store/failover/FailoverMetadataReportTest.java
@@ -215,8 +215,7 @@ public class FailoverMetadataReportTest {
}
}
}
- } catch (NoSuchFieldException ignored) {
- } catch (IllegalAccessException ignored) {
+ } catch (NoSuchFieldException | IllegalAccessException ignored) {
}
}
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
index a794863..74115be 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
@@ -389,11 +389,9 @@ public class DubboProtocol extends AbstractProtocol {
} catch (ClassNotFoundException e) {
throw new RpcException("Cannot find the serialization optimizer class: " + className, e);
- } catch (InstantiationException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new RpcException("Cannot instantiate the serialization optimizer class: " + className, e);
- } catch (IllegalAccessException e) {
- throw new RpcException("Cannot instantiate the serialization optimizer class: " + className, e);
}
}