Skip to content

Commit

Permalink
bugfix can not startup when error monitoring template yml file (#1153)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 authored Aug 7, 2023
1 parent a3854ff commit 51b0f07
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -332,14 +333,19 @@ 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) {
appDefines.put(app.getApp().toLowerCase(), app);
}
} catch (IOException e) {
log.error(e.getMessage(), e);
throw e;
log.error("Ignore this template file: {}.", appFile.getName());
}
}
}
Expand Down

0 comments on commit 51b0f07

Please sign in to comment.