This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit 9cc764aa5002bfc68a5b0acef579a557b192f859 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 16:07:05 2016 +0100 fixes #1339: Check the template directory exists (or create it at launch time ?) --- src/main/java/org/chorem/jtimer/JTimerConfig.java | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimerConfig.java b/src/main/java/org/chorem/jtimer/JTimerConfig.java index ac98d49..beb4fa5 100644 --- a/src/main/java/org/chorem/jtimer/JTimerConfig.java +++ b/src/main/java/org/chorem/jtimer/JTimerConfig.java @@ -160,22 +160,27 @@ public class JTimerConfig { */ public Map<String, Object> getTaskTemplates() { Map<String, Object> result = new TreeMap<>(); + String tplDirectory = appConfig.getOption(JTimerOption.UI_TEMPLATE_DIRECTORY.key); - Path backupDir = FileSystems.getDefault().getPath(tplDirectory); - try (DirectoryStream<Path> stream = Files.newDirectoryStream(backupDir)) { - Yaml yaml = new Yaml(); - for (Path file : stream) { - try (InputStream is = new FileInputStream(file.toFile())) { - Object r = yaml.load(is); - String name = FilenameUtils.removeExtension(file.getFileName().toString()); - result.put(name, r); + Path tplDir = FileSystems.getDefault().getPath(tplDirectory); + + if (Files.exists(tplDir)) { + try (DirectoryStream<Path> stream = Files.newDirectoryStream(tplDir)) { + Yaml yaml = new Yaml(); + for (Path file : stream) { + try (InputStream is = new FileInputStream(file.toFile())) { + Object r = yaml.load(is); + String name = FilenameUtils.removeExtension(file.getFileName().toString()); + result.put(name, r); + } + } + } catch (DirectoryIteratorException|IOException ex) { + if (log.isErrorEnabled()) { + log.error("Can't create backup", ex); } - } - } catch (DirectoryIteratorException|IOException ex) { - if (log.isErrorEnabled()) { - log.error("Can't create backup", ex); } } + return result; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.