SpringLiquibase: includeAll within jar causes NullPointerException

Description

This issue is related to CORE-1986. If an includeAll is used inside a jar to include other files from the jar a NullPointerException occurs.

The attached files include a jar with the following structure:

1 2 3 4 changelogs |-- test-changeLog1.xml // includesAll from "test" directory \-- test \-- test-changeLog2.xml

The file test-changeLog1.xml includes all files from the "test" directory also inside the jar, causing the following exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... Caused by: liquibase.exception.SetupException: liquibase.exception.SetupException at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:247) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:211) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 47 more Caused by: liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:353) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:245) ... 49 more Caused by: liquibase.exception.SetupException at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:331) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:261) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:211) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 51 more Caused by: java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:303) at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.list(SpringLiquibase.java:91) at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:313) ... 54 more

The path passed to super.list() in SpringLiquibase$SpringResourceOpener has the form

1 jar:file:/home/user/Desktop/test/test-liquibase.jar!/changelogs/test/

This causes list() to return null because classLoader.getResource(path) returns null.

As a workaround the code from the first comment on works.

Environment

Spring 3.0.6.RELEASE
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

Status

Assignee

Unassigned

Reporter

André Gustavo Rigon

Labels

None

Components

Fix versions

Affects versions

3.3.0

Priority

Major