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:

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:

... 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

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 https://liquibase.jira.com/browse/CORE-1986#icft=CORE-1986 works.

Environment

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

Attachments

4

Activity

Show:

André Gustavo Rigon 
December 9, 2014 at 11:40 AM

Thank you for the quick reply, but after testing in 3.3.1 I got a SetupException and opened CORE-2166. It includes a test project which reproduces the problem.

Nathan Voxland 
December 6, 2014 at 1:54 AM

Added null check

Fixed

Details

Reporter

Fix versions

Affects versions

Priority

Created December 5, 2014 at 6:21 PM
Updated December 9, 2014 at 11:40 AM
Resolved December 6, 2014 at 1:54 AM

Flag notifications