cachedSnapshot = null;
WaveletOperation op;
try {
op = serializer.deserializeDelta(change.getPayload());
} catch (MessageException e) {
throw new ChangeRejected("Malformed op: " + change, e);
}
if (wavelet == null) {
try {
wavelet = WaveletUtil.buildWaveletFromInitialOps(
IdHack.FAKE_WAVELET_NAME, Collections.singletonList(op));
} catch (OperationException e) {
throw new ChangeRejected("Invalid initial op: " + op, e);
}
} else {
try {
op.apply(wavelet);
} catch (OperationException e) {
// Operation failed. The wavelet is still intact, however, so just
// report the failure and continue on.
throw new ChangeRejected("Invalid op at version " + wavelet.getVersion() + ": " + op, e);
}
}
}