replace assert with exception

* assert hides errors when code is executed without -ea
* it is easier to set up breakpoint
This commit is contained in:
Stepan Koltsov
2012-04-24 22:14:00 +04:00
parent c686184847
commit ae913f4c0e
@@ -32,11 +32,12 @@ public class Slices {
@Override
public <K, V> boolean processRewrite(WritableSlice<K, V> slice, K key, V oldValue, V newValue) {
assert (oldValue == null && newValue == null) || (oldValue != null && oldValue.equals(newValue))
: "Rewrite at slice " + slice +
" key: " + key +
" old value: " + oldValue + '@' + System.identityHashCode(oldValue) +
" new value: " + newValue + '@' + System.identityHashCode(newValue);
if (!((oldValue == null && newValue == null) || (oldValue != null && oldValue.equals(newValue)))) {
throw new IllegalStateException("Rewrite at slice " + slice +
" key: " + key +
" old value: " + oldValue + '@' + System.identityHashCode(oldValue) +
" new value: " + newValue + '@' + System.identityHashCode(newValue));
}
return true;
}
};