You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2022/04/04 18:07:18 UTC

[shardingsphere] branch master updated: Add ShardingSphereSPIException (#16594)

This is an automated email from the ASF dual-hosted git repository.

menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 8553b8755c2 Add ShardingSphereSPIException (#16594)
8553b8755c2 is described below

commit 8553b8755c2d4a931abaa80444def1c28b5921b6
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Apr 5 02:07:00 2022 +0800

    Add ShardingSphereSPIException (#16594)
---
 .../spi/exception/ServiceLoaderInstantiationException.java |  2 +-
 .../spi/exception/ServiceProviderNotFoundException.java    |  2 +-
 ...ationException.java => ShardingSphereSPIException.java} | 14 +++++++++-----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java
index 06c9648ab86..48ccb12daa3 100644
--- a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java
+++ b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.spi.exception;
 /**
  * Service loader instantiation exception.
  */
-public final class ServiceLoaderInstantiationException extends RuntimeException {
+public final class ServiceLoaderInstantiationException extends ShardingSphereSPIException {
     
     private static final long serialVersionUID = 6261274443437676201L;
     
diff --git a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceProviderNotFoundException.java b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceProviderNotFoundException.java
index 2b4a41e4cfa..d859383c894 100644
--- a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceProviderNotFoundException.java
+++ b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceProviderNotFoundException.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.spi.exception;
 /**
  * Service provider not found exception.
  */
-public final class ServiceProviderNotFoundException extends RuntimeException {
+public final class ServiceProviderNotFoundException extends ShardingSphereSPIException {
     
     private static final long serialVersionUID = -3730257541332863236L;
     
diff --git a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ShardingSphereSPIException.java
similarity index 68%
copy from shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java
copy to shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ShardingSphereSPIException.java
index 06c9648ab86..7e194f95d4e 100644
--- a/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ServiceLoaderInstantiationException.java
+++ b/shardingsphere-spi/src/main/java/org/apache/shardingsphere/spi/exception/ShardingSphereSPIException.java
@@ -18,13 +18,17 @@
 package org.apache.shardingsphere.spi.exception;
 
 /**
- * Service loader instantiation exception.
+ * ShardingSphere SPI exception.
  */
-public final class ServiceLoaderInstantiationException extends RuntimeException {
+public abstract class ShardingSphereSPIException extends RuntimeException {
     
-    private static final long serialVersionUID = 6261274443437676201L;
+    private static final long serialVersionUID = -3044979409127407014L;
     
-    public ServiceLoaderInstantiationException(final Class<?> clazz, final Exception cause) {
-        super(String.format("Can not find public default constructor for SPI class `%s`", clazz.getName()), cause);
+    public ShardingSphereSPIException(final String message) {
+        super(message);
+    }
+    
+    public ShardingSphereSPIException(final String message, final Exception cause) {
+        super(message, cause);
     }
 }