From 827701fa059c89d31d982296fed105cc2208209b Mon Sep 17 00:00:00 2001 From: Denis Kuniss Date: Fri, 7 Feb 2025 19:48:59 +0100 Subject: [PATCH 1/2] Corrected GH issue #11 and prepared release 4.0.1 --- CHANGELOG.md | 4 ++++ build.gradle | 2 +- .../java/jpos/config/simple/xml/JavaxRegPopulator.java | 8 ++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2c055c..f0ebff2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log for javapos-config-loader +## 4.0.1 + +- corrected logging output when loading class-path resources (solved GH issue [#11](https://github.com/JavaPOSWorkingGroup/javapos-config-loader/issues/11)) + ## 4.0.0 - jpos.config.DefaultCompositeRegPopulator.load() is throwing more specific IllegalArgument exception instead of RuntimeException diff --git a/build.gradle b/build.gradle index 3bc0c5b..1cf4bff 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ wrapper { def artifactName = 'javapos-config-loader' group='org.javapos' -version='4.0.0' // if version is going to be changed, first add "-SNAPSHOT" to test publishing to MavenCentral's Snapshot repo +version='4.0.1-SNAPSHOT' // if version is going to be changed, first add "-SNAPSHOT" to test publishing to MavenCentral's Snapshot repo /////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java b/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java index 4b61fac..22a602a 100644 --- a/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java +++ b/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java @@ -143,8 +143,12 @@ public void load() { @Override public void load(String fileName) { - tracer.println("loading JavaPOS configuration from file " + new File(fileName).getAbsolutePath()); - try (InputStream is = new File(fileName).exists() ? new FileInputStream(fileName) : findFileInClasspath(fileName)) { + File file = new File(fileName); + if (file.exists()) + tracer.println("loading JavaPOS configuration from file " + file.getAbsolutePath()); + else + tracer.println("loading JavaPOS configuration from classpath resource file " + fileName); + try (InputStream is = file.exists() ? new FileInputStream(fileName) : findFileInClasspath(fileName)) { load(is); } catch (Exception e) { tracer.println("Error while loading populator file Exception.message: " + e.getMessage()); From b928ee29ea31a798f94323f489332da8c30d0c8c Mon Sep 17 00:00:00 2001 From: Denis Kuniss Date: Fri, 7 Feb 2025 20:03:15 +0100 Subject: [PATCH 2/2] Improved logging message for GH issue #11 further. --- src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java b/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java index 22a602a..57d0787 100644 --- a/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java +++ b/src/main/java/jpos/config/simple/xml/JavaxRegPopulator.java @@ -145,9 +145,9 @@ public void load() { public void load(String fileName) { File file = new File(fileName); if (file.exists()) - tracer.println("loading JavaPOS configuration from file " + file.getAbsolutePath()); + tracer.println("trying to load JavaPOS configuration from file " + file.getAbsolutePath()); else - tracer.println("loading JavaPOS configuration from classpath resource file " + fileName); + tracer.println("because JavaPOS configuration file '" + fileName + "' does not exist, trying to load it as classpath resource"); try (InputStream is = file.exists() ? new FileInputStream(fileName) : findFileInClasspath(fileName)) { load(is); } catch (Exception e) {