mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
fix: determinePackageVersion throw exception in ide env
This commit is contained in:
parent
5b94247daf
commit
7eea92bfc7
@ -42,7 +42,12 @@ public class JavaUtils {
|
||||
if (connection instanceof JarURLConnection) {
|
||||
return getImplementationVersion(((JarURLConnection) connection).getJarFile());
|
||||
}
|
||||
try (JarFile jarFile = new JarFile(new File(codeSourceLocation.toURI()))) {
|
||||
final File file = new File(codeSourceLocation.toURI());
|
||||
// idea 场景,查找版本失败
|
||||
if (file.isDirectory()) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
try (JarFile jarFile = new JarFile(file)) {
|
||||
return getImplementationVersion(jarFile);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user