This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 facb98229b4 Wrap IllegalStateException in
DataSourcePoolPropertiesValidator (#40199)
facb98229b4 is described below
commit facb98229b41b6220339240ce9903502b152563f
Author: Eunbin Son <[email protected]>
AuthorDate: Thu Oct 15 21:28:02 2026 +0900
Wrap IllegalStateException in DataSourcePoolPropertiesValidator (#40199)
---
RELEASE-NOTES.md | 1 +
.../props/validator/DataSourcePoolPropertiesValidator.java | 2 +-
.../validator/DataSourcePoolPropertiesValidatorTest.java | 12 ++++++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 53c514807a9..1f71f6341eb 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -25,6 +25,7 @@
1. Infra: Reject incomplete WEIGHT load balancer properties during rule
configuration validation -
[#39378](https://github.com/apache/shardingsphere/pull/39378)
1. Infra: Fix stale weights in WEIGHT load balancer after same-size read data
source changes - [#39995](https://github.com/apache/shardingsphere/pull/39995)
1. Infra: Fix false table existence check failures for quoted schema names in
`SupportedSQLCheckEngine` -
[#40069](https://github.com/apache/shardingsphere/pull/40069)
+1. Infra: Wrap `IllegalStateException` from data source pool properties
content validation in `DataSourcePoolPropertiesValidator` -
[#40199](https://github.com/apache/shardingsphere/pull/40199)
1. SQL Parser: Preserve unary NOT as NotExpression for scalar-subquery table
extraction in PostgreSQL -
[#38187](https://github.com/apache/shardingsphere/pull/38187)
1. SQL Parser: Fix wrong parameter index parse in MySQL, Doris -
[#38624](https://github.com/apache/shardingsphere/pull/38624)
1. SQL Parser: Fix reversed parameter marker order for openGauss `LIMIT
offset, row-count` -
[#39242](https://github.com/apache/shardingsphere/pull/39242)
diff --git
a/infra/data-source-pool/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidator.java
b/infra/data-source-pool/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidator.java
index 03ec0abd48e..c6eba88c1cb 100644
---
a/infra/data-source-pool/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidator.java
+++
b/infra/data-source-pool/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidator.java
@@ -67,7 +67,7 @@ public final class DataSourcePoolPropertiesValidator {
private static void validateProperties(final String dataSourceName, final
DataSourcePoolProperties props) throws InvalidDataSourcePoolPropertiesException
{
try {
TypedSPILoader.findService(DataSourcePoolPropertiesContentValidator.class,
props.getPoolClassName()).ifPresent(optional -> optional.validate(props));
- } catch (final IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException | IllegalStateException ex) {
throw new InvalidDataSourcePoolPropertiesException(dataSourceName,
ex.getMessage());
}
}
diff --git
a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidatorTest.java
b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidatorTest.java
index 231ad256eb5..0482922d8b7 100644
---
a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidatorTest.java
+++
b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/validator/DataSourcePoolPropertiesValidatorTest.java
@@ -97,6 +97,18 @@ class DataSourcePoolPropertiesValidatorTest {
}
}
+ @Test
+ void assertValidateWithIllegalStateContentProperties() {
+ DataSourcePoolPropertiesContentValidator validator =
mock(DataSourcePoolPropertiesContentValidator.class);
+ DataSourcePoolProperties dataSourcePoolProperties = new
DataSourcePoolProperties(HikariDataSource.class.getName(),
createHikariDataSourceProperties(MOCKED_URL));
+ doThrow(new IllegalStateException("mock illegal state
properties")).when(validator).validate(dataSourcePoolProperties);
+ try (MockedStatic<TypedSPILoader> typedSPILoader =
mockStatic(TypedSPILoader.class, CALLS_REAL_METHODS)) {
+ typedSPILoader.when(() ->
TypedSPILoader.findService(DataSourcePoolPropertiesContentValidator.class,
HikariDataSource.class.getName())).thenReturn(Optional.of(validator));
+ assertInvalidDataSource(DataSourcePoolPropertiesValidator.validate(
+ Collections.singletonMap("foo_ds",
dataSourcePoolProperties), Collections.emptySet()), "Invalid data source
`foo_ds`, error message is: mock illegal state properties");
+ }
+ }
+
@Test
void assertValidateWithCreateFailure() {
Map<String, Object> props = createMockedDataSourceProperties();