OPENDJ-1753 NPE when deleting backend index on an attribute index
Problem was due to incorrect caching of Exchange objects in the PersistItStorage class.
Problem is too complex to explain easily in a few words, but here is what needs to be said about it:
PersistItStorage.StorageImpl.deleteTree() correctly calls Persistit.releaseExchange(), but fails to remove the cached object in PersistItStorage.StorageImpl.exchanges Map field.
This puts the transaction in an invalid state, particularly for the State index, which then later triggers the NPE when the Exchange object is shared accross index objects.
PersistItStorage.java:
In deleteTree(), remove the Exchange object from the transaction local cache before releasing it back to PersistIt.
Renamed getExchange() and getExchange0() to getExchangeFromCache() and getNewExchange().