From dee496b3499e73b843acca38edda8b074b290bef Mon Sep 17 00:00:00 2001 From: will Date: Mon, 19 Dec 2022 23:00:16 +0800 Subject: [PATCH] fix: default theme cannot be initialized in the jar distribution (#2991) #### What type of PR is this? /kind bug #### What this PR does / why we need it: To fix that default earth theme file not found in system initialization. #### Which issue(s) this PR fixes: Fixes #2910 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note NONE ``` --- .../run/halo/app/infra/DefaultThemeInitializer.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/run/halo/app/infra/DefaultThemeInitializer.java b/src/main/java/run/halo/app/infra/DefaultThemeInitializer.java index 72963f080..460853c9e 100644 --- a/src/main/java/run/halo/app/infra/DefaultThemeInitializer.java +++ b/src/main/java/run/halo/app/infra/DefaultThemeInitializer.java @@ -1,12 +1,10 @@ package run.halo.app.infra; import java.io.IOException; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.concurrent.CountDownLatch; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationListener; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.stereotype.Component; import org.springframework.util.ResourceUtils; import run.halo.app.core.extension.theme.ThemeService; @@ -47,15 +45,16 @@ public class DefaultThemeInitializer implements ApplicationListener latch.countDown()) .subscribe(theme -> log.info("Initialized default theme: {}", theme.getMetadata().getName())); latch.await(); // Because default active theme is default, we don't need to enabled it manually. - } catch (IOException | URISyntaxException | InterruptedException e) { + } catch (IOException | InterruptedException e) { // we should skip the initialization error at here log.warn("Failed to initialize theme from " + location, e); }