未验证 提交 b591da08 编写于 作者: 流浪诗人 提交者: GitHub

Fix 4805. (#4816)

上级 6cd2000f
......@@ -73,13 +73,14 @@ public final class SQLCasesLoader {
return result;
}
@SneakyThrows
private static Map<String, SQLCase> loadSQLCasesFromTargetDirectory(final String path) {
Map<String, SQLCase> result = new TreeMap<>();
URL url = SQLCasesLoader.class.getClassLoader().getResource(path);
if (null == url) {
return result;
}
File filePath = new File(url.getPath());
File filePath = new File(url.toURI().getPath());
if (!filePath.exists()) {
return result;
}
......
......@@ -18,6 +18,7 @@
package org.apache.shardingsphere.sql.parser.integrate.jaxb;
import com.google.common.base.Preconditions;
import lombok.SneakyThrows;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.domain.SQLParserTestCases;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.domain.statement.SQLParserTestCase;
......@@ -41,10 +42,11 @@ public final class SQLParserTestCasesRegistry {
sqlParserTestCases = load(rootDirectory);
}
@SneakyThrows
private Map<String, SQLParserTestCase> load(final String directory) {
URL url = SQLParserTestCasesRegistry.class.getClassLoader().getResource(directory);
Preconditions.checkNotNull(url, "Can not find SQL parser test cases.");
File[] files = new File(url.getPath()).listFiles();
File[] files = new File(url.toURI().getPath()).listFiles();
Preconditions.checkNotNull(files, "Can not find SQL parser test cases.");
Map<String, SQLParserTestCase> result = new HashMap<>(Short.MAX_VALUE, 1);
for (File each : files) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册