This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 1f6ce7b5a1b Improve PipelineInvalidParameterException error message
(#36865)
1f6ce7b5a1b is described below
commit 1f6ce7b5a1bf90da106c3df32158a5959f90e96f
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Mon Oct 13 10:32:02 2025 +0800
Improve PipelineInvalidParameterException error message (#36865)
---
.../consistencycheck/table/DataMatchTableDataConsistencyChecker.java | 4 ++--
.../core/exception/param/PipelineInvalidParameterException.java | 2 +-
.../shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java | 2 +-
.../shardingsphere/data/pipeline/cdc/generator/CDCResponseUtils.java | 2 +-
.../data/pipeline/scenario/migration/api/MigrationJobAPI.java | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableDataConsistencyChecker.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableDataConsistencyChecker.java
index c0ba06806b1..d0208075174 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableDataConsistencyChecker.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableDataConsistencyChecker.java
@@ -70,7 +70,7 @@ public final class DataMatchTableDataConsistencyChecker
implements TableDataCons
throw new PipelineInvalidParameterException("'chunk-size' is not a
valid number: `" + chunkSizeText + "`");
}
if (result <= 0) {
- throw new PipelineInvalidParameterException("Invalid 'chunk-size':
" + result);
+ throw new PipelineInvalidParameterException("Invalid 'chunk-size'
value: `" + result + "`, it should be a positive integer.");
}
return result;
}
@@ -83,7 +83,7 @@ public final class DataMatchTableDataConsistencyChecker
implements TableDataCons
try {
return
StreamingRangeType.valueOf(streamingRangeTypeText.toUpperCase());
} catch (final IllegalArgumentException ex) {
- throw new
PipelineInvalidParameterException("'streaming-range-type' is not a valid value:
`" + streamingRangeTypeText
+ throw new PipelineInvalidParameterException("Invalid
'streaming-range-type' value: `" + streamingRangeTypeText
+ "`, expected values are " +
Arrays.toString(StreamingRangeType.values()));
}
}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/param/PipelineInvalidParameterException.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/param/PipelineInvalidParameterException.java
index c98dad22a67..6cb4fb50563 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/param/PipelineInvalidParameterException.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/param/PipelineInvalidParameterException.java
@@ -28,6 +28,6 @@ public final class PipelineInvalidParameterException extends
PipelineSQLExceptio
private static final long serialVersionUID = -2162309404414015630L;
public PipelineInvalidParameterException(final String message) {
- super(XOpenSQLState.INVALID_PARAMETER_VALUE, 0, String.format("There
is invalid parameter value '%s'.", message));
+ super(XOpenSQLState.INVALID_PARAMETER_VALUE, 0, String.format("There
is invalid parameter value. %s", message));
}
}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
index 8e3cade7c9b..81ad3a165f4 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
@@ -47,7 +47,7 @@ public final class PipelineDataNodeUtils {
* @throws PipelineInvalidParameterException thrown invalid parameter
exception when can't get data nodes.
*/
public static Map<String, List<DataNode>> buildTableAndDataNodesMap(final
ShardingSphereDatabase database, final Collection<String> tableNames) {
- ShardingSpherePreconditions.checkNotEmpty(tableNames, () -> new
PipelineInvalidParameterException("Tables can not empty."));
+ ShardingSpherePreconditions.checkNotEmpty(tableNames, () -> new
PipelineInvalidParameterException("Table names are empty."));
Map<String, List<DataNode>> result = new HashMap<>(tableNames.size(),
1F);
Collection<DataNodeRuleAttribute> attributes =
database.getRuleMetaData().getAttributes(DataNodeRuleAttribute.class);
// TODO support virtual data source name
diff --git
a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/generator/CDCResponseUtils.java
b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/generator/CDCResponseUtils.java
index f625621cf97..1e8072210bc 100644
---
a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/generator/CDCResponseUtils.java
+++
b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/generator/CDCResponseUtils.java
@@ -69,7 +69,7 @@ public final class CDCResponseUtils {
case RESPONSE_NOT_SET:
break;
default:
- throw new
PipelineInvalidParameterException(responseCase.name());
+ throw new PipelineInvalidParameterException("Unknown response
case: `" + responseCase.name() + "`.");
}
return result.build();
}
diff --git
a/kernel/data-pipeline/scenario/migration/core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
b/kernel/data-pipeline/scenario/migration/core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
index ae3750b8769..56fa46b90e5 100644
---
a/kernel/data-pipeline/scenario/migration/core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
+++
b/kernel/data-pipeline/scenario/migration/core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
@@ -132,7 +132,7 @@ public final class MigrationJobAPI implements
TransmissionJobAPI {
.sorted(Comparator.comparing(MigrationSourceTargetEntry::getTargetTableName).thenComparing(each
-> each.getSource().format())).collect(Collectors.toList())) {
sourceDataNodes.computeIfAbsent(each.getTargetTableName(), key ->
new LinkedList<>()).add(each.getSource());
ShardingSpherePreconditions.checkState(1 ==
sourceDataNodes.get(each.getTargetTableName()).size(),
- () -> new PipelineInvalidParameterException("more than one
source table for " + each.getTargetTableName()));
+ () -> new PipelineInvalidParameterException("More than one
source table for " + each.getTargetTableName()));
String dataSourceName = each.getSource().getDataSourceName();
if (configSources.containsKey(dataSourceName)) {
continue;