I was running the generateChangeLog command and I ran into the following error:
INFO 6/14/11 10:15 AM:liquibase: c:\temp\test.diff exists, appending
Liquibase Update Failed: Unknown Reason
SEVERE 6/14/11 10:15 AM:liquibase: Unknown Reason
I checked out the code and ran it through the debugger. I found that the serializer is determined from the file extension of the --changeLogFile parameter. As I walked through the code in the debugger, there are two serializers set up: xml and txt. If you provide a different extension for the output file (as I did), you’ll get a NPE as above because the code on line 405 in liquibase.diff.DiffResult will return null:
ChangeLogSerializer changeLogSerializer = serializerFactory.getSerializer(changeLogFile);
I would suggest doing the one of the following:
at the very least, check after line 405 and make sure the serializer isn’t null – throw an exception with a meaningful message if it is – even better (because sooner), as part of the validation of the command-line arguments, make sure the given extension is valid; or
perhaps change the SerializerFactory to default to either the xml or txt serializer if one can’t be found for the given extension
I’d be happy to submit a patch if it would help – let me know!
Thanks for the great tool!