You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2024/03/07 06:52:12 UTC
(shardingsphere) branch master updated: Fix SystemSchemaManager init error when application resource path has /schema. (#30415)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 93b004fab55 Fix SystemSchemaManager init error when application resource path has /schema. (#30415)
93b004fab55 is described below
commit 93b004fab55f3d8db6a17ded3afdf188e223b47f
Author: Cong Hu <ia...@qq.com>
AuthorDate: Thu Mar 7 14:52:06 2024 +0800
Fix SystemSchemaManager init error when application resource path has /schema. (#30415)
---
.../database/schema/manager/SystemSchemaManager.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/manager/SystemSchemaManager.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/manager/SystemSchemaManager.java
index 975c0a75188..04a36c9741f 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/manager/SystemSchemaManager.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/manager/SystemSchemaManager.java
@@ -51,14 +51,14 @@ public final class SystemSchemaManager {
static {
List<String> resourceNames;
try (Stream<String> resourceNameStream = ClasspathResourceDirectoryReader.read("schema")) {
- resourceNames = resourceNameStream.collect(Collectors.toList());
+ resourceNames = resourceNameStream.filter(each -> each.endsWith(".yaml")).collect(Collectors.toList());
}
- DATABASE_TYPE_SCHEMA_TABLE_MAP = resourceNames.stream().map(resourceName -> resourceName.split("/")).collect(Collectors.groupingBy(path -> path[1], CaseInsensitiveMap::new,
- Collectors.groupingBy(path -> path[2], CaseInsensitiveMap::new, Collectors.mapping(path -> StringUtils.removeEnd(path[3], ".yaml"),
- Collectors.toCollection(CaseInsensitiveSet::new)))));
- DATABASE_TYPE_SCHEMA_RESOURCE_MAP = resourceNames.stream().map(resourceName -> resourceName.split("/")).collect(Collectors.groupingBy(path -> path[1], CaseInsensitiveMap::new,
- Collectors.groupingBy(path -> path[2], CaseInsensitiveMap::new, Collectors.mapping(path -> String.join("/", path),
- Collectors.toCollection(CaseInsensitiveSet::new)))));
+ DATABASE_TYPE_SCHEMA_TABLE_MAP = resourceNames.stream().map(resourceName -> resourceName.split("/")).filter(each -> each.length == 4)
+ .collect(Collectors.groupingBy(path -> path[1], CaseInsensitiveMap::new, Collectors.groupingBy(path -> path[2], CaseInsensitiveMap::new,
+ Collectors.mapping(path -> StringUtils.removeEnd(path[3], ".yaml"), Collectors.toCollection(CaseInsensitiveSet::new)))));
+ DATABASE_TYPE_SCHEMA_RESOURCE_MAP = resourceNames.stream().map(resourceName -> resourceName.split("/")).filter(each -> each.length == 4)
+ .collect(Collectors.groupingBy(path -> path[1], CaseInsensitiveMap::new, Collectors.groupingBy(path -> path[2], CaseInsensitiveMap::new,
+ Collectors.mapping(path -> String.join("/", path), Collectors.toCollection(CaseInsensitiveSet::new)))));
}
/**