anathema/anathema — pull request #117 by curttasker (2012-04-06 03:09:00+00:00)
Title: Fix for NullPointerException when launching Anathema from a fresh install.

When you try to run Anathema from a freshly built installation, it causes a NullPointerException.

When it uses ```DatabaseUtils.getDatabaseVersion()``` on a non-existant database, it returns null. The null is checked for in several places, but not in the new ```logger.info()``` statement added in [this commit](https://github.com/anathema/anathema/commit/7d6e90add41fbf49bb4f7c2cd0d5b1e87158f75d). Calling ```dbVersion.asString()``` when dbVersion is null throws this exception.

The null checks currently in place for this use case are in the following functions:
- ```Version.isLargerThan( Version )```
- ```Version.equals( Version )```
- ```DatabaseConversionBootJob.updateDbVersion( Version, Version )```

I added another null check in ```DatabaseConversionBootJob.run()``` around the ```logger.info()``` statement to handle this particular exception. Honestly I'd love to see either a null check in ```Version.compareTo( Version )```, or just make it private, as its being used by ```Version.equals( Version )``` and ```Version.isLargerThan( Version )```, both of which have null checks already.

My fix may not be exactly what you were looking for, so feel free to change it.
On a side note, why create a ```Version.asString()``` method? Why not just overload ```Version.toString()```?