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:
extio-de
2026-06-27 12:52:27 +02:00
parent 03e14f365d
commit f948be3fe4
3 changed files with 5 additions and 3 deletions

View File

@@ -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)) {

View File

@@ -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)) {