From 192a27e1e8ddb2bde1b3e24e65d9c853a23d1002 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 7 Jan 2014 09:35:52 +0100 Subject: [PATCH] [#2932] Retry loading the GenerationTool configuration file with a / prepended if it fails --- .../java/org/jooq/util/GenerationTool.java | 18 +++++++++++++----- .../launch/GenerationTool MySQL test.launch | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java index 603fb0712d..d1554b0117 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/util/GenerationTool.java @@ -120,11 +120,19 @@ public class GenerationTool { InputStream in = GenerationTool.class.getResourceAsStream(args[0]); if (in == null) { - log.error("Cannot find " + args[0]); - log.error("-----------"); - log.error("Please be sure it is located on the classpath and qualified as a classpath location."); - log.error("If it is located at the current working directory, try adding a '/' to the path"); - error(); + + // [#2932] Retry loading the file, if it wasn't found. This may be helpful + // to some users who were unaware that this file is loaded from the classpath + if (!args[0].startsWith("/")) + in = GenerationTool.class.getResourceAsStream("/" + args[0]); + + if (in == null) { + log.error("Cannot find " + args[0]); + log.error("-----------"); + log.error("Please be sure it is located on the classpath and qualified as a classpath location."); + log.error("If it is located at the current working directory, try adding a '/' to the path"); + error(); + } } log.info("Initialising properties", args[0]); diff --git a/jOOQ-test/launch/GenerationTool MySQL test.launch b/jOOQ-test/launch/GenerationTool MySQL test.launch index 91b2f9ffab..30176f2ae4 100644 --- a/jOOQ-test/launch/GenerationTool MySQL test.launch +++ b/jOOQ-test/launch/GenerationTool MySQL test.launch @@ -23,7 +23,7 @@ - +