fix(StorageServiceImpl): handle null parent path when resolving jar location
fix(StaticResourceServiceImpl): handle null parent path when resolving jar location chore(pom.xml): bump version to 1.0.22
This commit is contained in:
@@ -28,7 +28,8 @@ public class StaticResourceServiceImpl implements StaticResourceService {
|
||||
if (location == null) {
|
||||
try {
|
||||
final URL url = StorageServiceImpl.class.getProtectionDomain().getCodeSource().getLocation();
|
||||
final Path jarPath = Paths.get(url.toURI()).getParent().toAbsolutePath().normalize();
|
||||
final Path parent = Paths.get(url.toURI()).getParent();
|
||||
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : Paths.get(url.toURI()).toAbsolutePath().normalize();
|
||||
|
||||
final String currentSubDir = jarPath.getFileName().toString();
|
||||
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
||||
|
||||
@@ -38,7 +38,8 @@ public class StorageServiceImpl implements StorageService {
|
||||
if (location == null) {
|
||||
try {
|
||||
final URL url = StorageServiceImpl.class.getProtectionDomain().getCodeSource().getLocation();
|
||||
final Path jarPath = Paths.get(url.toURI()).getParent().toAbsolutePath().normalize();
|
||||
final Path parent = Paths.get(url.toURI()).getParent();
|
||||
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : Paths.get(url.toURI()).toAbsolutePath().normalize();
|
||||
|
||||
final String currentSubDir = jarPath.getFileName().toString();
|
||||
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
||||
|
||||
Reference in New Issue
Block a user