excilys/spring-dbunit — Issue #13: DataSetFormatOptions is null by default in servlet module causing NPE
Author: sylvainleduby
Created: 2012-03-05 16:11:11+00:00
State: open

When loading DBUnit DataSets on web application startup, default DataSetFormatOptions is null and causes a NPE in DataSetFormat.java at line 77:
builder.setColumnSensing(options.isColumnSensing());

Here is the stacktrace:
java.lang.ExceptionInInitializerError
at com.excilys.ebi.spring.dbunit.servlet.DataLoaderListener.contextInitialized(DataLoaderListener.java:56)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at com.excilys.ebi.spring.dbunit.config.DataSetFormat$2.fromResource(DataSetFormat.java:77)
at com.excilys.ebi.spring.dbunit.config.DataSetFormat.loadMultiple(DataSetFormat.java:159)
at com.excilys.ebi.spring.dbunit.config.DataSetConfiguration.getDataSet(DataSetConfiguration.java:54)
at com.excilys.ebi.spring.dbunit.DbUnitDatabasePopulator.populate(DbUnitDatabasePopulator.java:54)
at com.excilys.ebi.spring.dbunit.DefaultDataLoader.executeOperation(DefaultDataLoader.java:66)
at com.excilys.ebi.spring.dbunit.DefaultDataLoader.execute(DefaultDataLoader.java:41)
at com.excilys.ebi.spring.dbunit.servlet.DataLoaderListener.contextInitialized(DataLoaderListener.java:52)
... 15 more

I have just added the listener in web.xml.
I don't see any configuration customization for the DataSetFormatOptions.

The test module works just fine.