diff --git a/manager/src/main/java/org/dromara/hertzbeat/manager/service/impl/AppServiceImpl.java b/manager/src/main/java/org/dromara/hertzbeat/manager/service/impl/AppServiceImpl.java index 49dee4198bc..4bfa8320474 100644 --- a/manager/src/main/java/org/dromara/hertzbeat/manager/service/impl/AppServiceImpl.java +++ b/manager/src/main/java/org/dromara/hertzbeat/manager/service/impl/AppServiceImpl.java @@ -321,6 +321,7 @@ public void run(String... args) throws Exception { inputStream.close(); } catch (Exception e) { log.error(e.getMessage(), e); + log.error("Ignore this template file: {}.", resource.getFilename()); } } } catch (Exception e) { @@ -332,6 +333,11 @@ public void run(String... args) throws Exception { log.info("load define path {}", defineAppPath); for (File appFile : Objects.requireNonNull(directory.listFiles())) { if (appFile.exists() && appFile.isFile()) { + if (appFile.isHidden() + || (!appFile.getName().endsWith("yml") && !appFile.getName().endsWith("yaml"))) { + log.error("Ignore this template file: {}.", appFile.getName()); + continue; + } try (FileInputStream fileInputStream = new FileInputStream(appFile)) { Job app = yaml.loadAs(fileInputStream, Job.class); if (app != null) { @@ -339,7 +345,7 @@ public void run(String... args) throws Exception { } } catch (IOException e) { log.error(e.getMessage(), e); - throw e; + log.error("Ignore this template file: {}.", appFile.getName()); } } }