Author: max.andersen(a)jboss.com
Date: 2006-09-14 12:03:06 -0400 (Thu, 14 Sep 2006)
New Revision: 10484
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java
trunk/HibernateExt/tools/src/testsupport/anttest-build.xml
Log:
HBX-627 NPE in hibernatetool task
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
===================================================================
---
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-09-14
13:41:02 UTC (rev 10483)
+++
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-09-14
16:03:06 UTC (rev 10484)
@@ -150,7 +150,9 @@
public void execute() {
-
+ if(configurationTask==null) {
+ throw new BuildException("No configuration specified. <" + getTaskName()
+ "> must have one of the following: <configuration>,
<jpaconfiguration>, <annotationconfiguration> or
<jdbcconfiguration>");
+ }
log("Executing Hibernate Tool with a " + configurationTask.getDescription()
);
validateParameters();
Iterator iterator = generators.iterator();
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java 2006-09-14
13:41:02 UTC (rev 10483)
+++
trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java 2006-09-14
16:03:06 UTC (rev 10484)
@@ -177,6 +177,15 @@
assertTrue(new File(baseDir, "queryresult.txt").exists());
}
+
+ public void testNoConfig() {
+ try {
+ executeTarget("noconfig-shoulderror");
+ } catch(BuildException e) {
+ assertTrue(e.getMessage().indexOf("No configuration specified")>=0);
+ }
+
+ }
public static Test suite() {
return new TestSuite(HibernateToolTest.class);
}
Modified: trunk/HibernateExt/tools/src/testsupport/anttest-build.xml
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/anttest-build.xml 2006-09-14 13:41:02 UTC
(rev 10483)
+++ trunk/HibernateExt/tools/src/testsupport/anttest-build.xml 2006-09-14 16:03:06 UTC
(rev 10484)
@@ -435,4 +435,18 @@
<antcall target="afterCfg2hbm" />
</target>
+
+
+ <target name="noconfig-shoulderror">
+ <taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="tasks.classpath" />
+ <hibernatetool destdir="${basedir}/target">
+ <classpath refid="full.path"/>
+ <!--configuration
configurationfile="${basedir}/src/main/webapp/WEB-INF/classes/hibernate.cfg.xml">
+ <fileset dir="${basedir}/src/main/webapp/WEB-INF/classes"
includes="**/*hbm.xml" excludes="**/Application.hbm.xml"/>
+ </configuration-->
+
+ <hbm2ddl drop="true" create="true" export="true"
outputfilename="generated-schema.sql" delimiter=";"
format="true" />
+ <hbm2doc />
+ </hibernatetool>
+ </target>
</project>
Show replies by date