diff --git a/core/src/main/java/cc/carm/plugin/minesql/util/DBPropertiesUtil.java b/core/src/main/java/cc/carm/plugin/minesql/util/DBPropertiesUtil.java index 86d28b7..ef4e454 100644 --- a/core/src/main/java/cc/carm/plugin/minesql/util/DBPropertiesUtil.java +++ b/core/src/main/java/cc/carm/plugin/minesql/util/DBPropertiesUtil.java @@ -17,7 +17,7 @@ public class DBPropertiesUtil { if (!propertiesFolder.exists() || !propertiesFolder.isDirectory()) return propertiesMap; File[] files = propertiesFolder.listFiles(); - if (files == null || files.length == 0) return propertiesMap; + if (files == null) return propertiesMap; for (File file : files) { if (!validateName(file.getName())) continue; String name = file.getName().substring(0, file.getName().lastIndexOf(".")); diff --git a/core/src/main/java/cc/carm/plugin/minesql/util/MavenReadUtil.java b/core/src/main/java/cc/carm/plugin/minesql/util/MavenReadUtil.java deleted file mode 100644 index e091441..0000000 --- a/core/src/main/java/cc/carm/plugin/minesql/util/MavenReadUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package cc.carm.plugin.minesql.util; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.InputStream; -import java.util.Properties; - -public class MavenReadUtil { - - public static String getMavenPropertiesPath(@NotNull String groupID, @NotNull String artifactID) { - return String.format("/META-INF/maven/%s/%s/pom.properties", groupID, artifactID); - } - - public static synchronized @Nullable String getVersion(@NotNull Object provider, - @NotNull String groupID, - @NotNull String artifactID) { - String path = getMavenPropertiesPath(groupID, artifactID); - String version = null; - // Using maven properties to get the version - try (InputStream is = provider.getClass().getResourceAsStream(path)) { - if (is != null) { - Properties p = new Properties(); - p.load(is); - version = p.getProperty("version", ""); - } - } catch (Exception ignored) { - } - - if (version != null) return version; - - // Fine, lets try Java API - Package pkg = provider.getClass().getPackage(); - if (pkg != null) { - version = pkg.getImplementationVersion(); - if (version == null) { - version = pkg.getSpecificationVersion(); - } - } - - return version; - } - - -}