Default schema not correct when using <tableExists>

Description

When using a <tableExists> precondition with a DB connection which is using a previously set schema, this schema is not used when checking for table existence.

Example:

My database contains 2 schemas: 'sch1' and 'sch2'
Sch1 contains 1 table 'user'
Sch2 is empty

Using:
<tableExists tableName="user"/>

With a connection set to Sch2, precondition is true because it finds table from Sch1.
This is when using a H2 database but I think the problem can occur with any database.

Actually the problem comes from AbstractJdbcDatabase#getJdbcSchemaName(Schema schema):

Actually when using <tableExists> from my example above, schema object is not null but contains a schema null and a catalog null. So default schema method is not used.
Simple fix could be to change the test by:

Regards

Environment

Web application on tomcat7

Reporter

Nicolas Daniels

Components

Fix versions

Affects versions

Priority

Major
Configure