commit 3c513525298b7269890c43dcf30a7e7d88ce4c26 parent f3165ef8b0ef399b3278f7aa332983151936e481 Author: Marcello Stanisci <stanisci.m@gmail.com> Date: Wed, 18 Sep 2019 23:31:29 +0200 Fix resource loading from JAR. Diffstat:
| M | src/main/java/tech/libeufin/XMLManagement.java | | | 7 | +++---- |
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/main/java/tech/libeufin/XMLManagement.java b/src/main/java/tech/libeufin/XMLManagement.java @@ -38,9 +38,8 @@ public class XMLManagement { */ public XMLManagement(){ ClassLoader classLoader = this.getClass().getClassLoader(); - - File ebics_hev_file = new File(classLoader.getResource("ebics_hev.xsd").getFile()); - Source schemas[] = {new StreamSource(ebics_hev_file) + InputStream ebics_hev_path = classLoader.getResourceAsStream("ebics_hev.xsd"); + Source schemas[] = {new StreamSource(ebics_hev_path) // other StreamSources for other schemas here .. }; @@ -49,7 +48,7 @@ public class XMLManagement { this.bundle = sf.newSchema(schemas); this.validator = this.bundle.newValidator(); } catch (SAXException e) { - System.out.println("SAX exception shall never happen here " + "(" + e + ")"); + e.printStackTrace(); } }