From bdd7637f8a48cc40c3ef1074f9f981d943c93be5 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Tue, 31 Oct 2023 21:44:06 +0800 Subject: [PATCH] Remove TracingStorageConverterNotFoundException (#2358) --- .../tracing/config/TracingConfiguration.java | 6 ++-- ...cingStorageConverterNotFoundException.java | 32 ------------------- 2 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/TracingStorageConverterNotFoundException.java diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/config/TracingConfiguration.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/config/TracingConfiguration.java index cd05904586..c700c470d8 100644 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/config/TracingConfiguration.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/config/TracingConfiguration.java @@ -20,8 +20,8 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.tracing.exception.TracingStorageConverterNotFoundException; import org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverterFactory; +import org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException; /** * Tracing configuration. @@ -39,7 +39,7 @@ public final class TracingConfiguration implements JobExtraConfiguration { @SuppressWarnings("unchecked") public TracingConfiguration(final String type, final T storage) { this.type = type; - this.tracingStorageConfiguration = TracingStorageConverterFactory.findConverter((Class) storage.getClass()) - .orElseThrow(() -> new TracingStorageConverterNotFoundException(storage.getClass())).convertToConfiguration(storage); + tracingStorageConfiguration = TracingStorageConverterFactory.findConverter((Class) storage.getClass()) + .orElseThrow(() -> new ServiceProviderNotFoundException(storage.getClass(), storage.getClass().getSimpleName())).convertToConfiguration(storage); } } diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/TracingStorageConverterNotFoundException.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/TracingStorageConverterNotFoundException.java deleted file mode 100644 index a2661fb1db..0000000000 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/TracingStorageConverterNotFoundException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.elasticjob.kernel.tracing.exception; - -import org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter; - -/** - * {@link TracingStorageConverter} not found exception. - */ -public final class TracingStorageConverterNotFoundException extends RuntimeException { - - private static final long serialVersionUID = -995858641205565452L; - - public TracingStorageConverterNotFoundException(final Class storageType) { - super(String.format("No TracingConfigurationConverter found for [%s]", storageType.getName())); - } -}