[#2932] Retry loading the GenerationTool configuration file with a / prepended if it fails

This commit is contained in:
Lukas Eder 2014-01-07 09:35:52 +01:00
parent c19fc7605f
commit 192a27e1e8
2 changed files with 14 additions and 6 deletions

View File

@ -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]);

View File

@ -23,7 +23,7 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jooq.util.GenerationTool"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="/org/jooq/configuration/${env_var:USERNAME}/mysql/library.xml"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="org/jooq/configuration/${env_var:USERNAME}/mysql/library.xml"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jOOQ-codegen"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:jOOQ-test}"/>