Source:
<code>IndexValue markAsUndeleted(StoreKey id, FileSpan fileSpan, MessageInfo info, long operationTimeMs, short lifeVersion) throws StoreException { boolean hasLifeVersion = IndexValue.hasLifeVersion(lifeVersion); validateFileSpan(fileSpan, true); long size = fileSpan.getEndOffset().getOffset() - fileSpan.getStartOffset().getOffset(); List<IndexValue> values = findAllIndexValuesForKey(id, null, EnumSet.allOf(IndexEntryType.class), validIndexSegments); IndexValue newValue; if (info != null) { if (!hasLifeVersion) { <START> throw new StoreException("MessageInfo of undelete carries invalid lifeVersion", <END> StoreErrorCodes.Initialization_Error); } newValue = new IndexValue(size, fileSpan.getStartOffset(), IndexValue.FLAGS_DEFAULT_VALUE, info.getExpirationTimeInMs(), info.getOperationTimeMs(), info.getAccountId(), info.getContainerId(), lifeVersion); if (info.isTtlUpdated() || (values != null && values.get(0).isTtlUpdate())) { newValue.setFlag(IndexValue.Flags.Ttl_Update_Index); } } else { validateSanityForUndelete(id, values, lifeVersion); IndexValue value = values.get(0); lifeVersion = hasLifeVersion ? lifeVersion : (short) (value.getLifeVersion() + 1); newValue = new IndexValue(value.getSize(), value.getOffset(), value.getFlags(), value.getExpiresAtMs(), operationTimeMs, value.getAccountId(), value.getContainerId(), lifeVersion); newValue.setNewOffset(fileSpan.getStartOffset()); newValue.setNewSize(size); } newValue.setFlag(IndexValue.Flags.Undelete_Index); newValue.clearFlag(IndexValue.Flags.Delete_Index); newValue.clearOriginalMessageOffset(); addToIndex(new IndexEntry(id, newValue, null), fileSpan); return newValue; }</code><technical_language>minor: this more descriptive invalid lifeVersion -1 (although I this exception happen in practice)</technical_language>

Target:
IndexValue markAsUndeleted(StoreKey id, FileSpan fileSpan, MessageInfo info, long operationTimeMs, short lifeVersion) throws StoreException { boolean hasLifeVersion = IndexValue.hasLifeVersion(lifeVersion); validateFileSpan(fileSpan, true); long size = fileSpan.getEndOffset().getOffset() - fileSpan.getStartOffset().getOffset(); List<IndexValue> values = findAllIndexValuesForKey(id, null, EnumSet.allOf(IndexEntryType.class), validIndexSegments); IndexValue newValue; if (info != null) { if (!hasLifeVersion) { throw new StoreException("MessageInfo of undelete carries invalid lifeVersion " + lifeVersion, StoreErrorCodes.Initialization_Error); } newValue = new IndexValue(size, fileSpan.getStartOffset(), IndexValue.FLAGS_DEFAULT_VALUE, info.getExpirationTimeInMs(), info.getOperationTimeMs(), info.getAccountId(), info.getContainerId(), lifeVersion); if (info.isTtlUpdated() || (values != null && values.get(0).isTtlUpdate())) { newValue.setFlag(IndexValue.Flags.Ttl_Update_Index); } } else { validateSanityForUndelete(id, values, lifeVersion); IndexValue value = values.get(0); lifeVersion = hasLifeVersion ? lifeVersion : (short) (value.getLifeVersion() + 1); newValue = new IndexValue(value.getSize(), value.getOffset(), value.getFlags(), value.getExpiresAtMs(), operationTimeMs, value.getAccountId(), value.getContainerId(), lifeVersion); newValue.setNewOffset(fileSpan.getStartOffset()); newValue.setNewSize(size); } newValue.setFlag(IndexValue.Flags.Undelete_Index); newValue.clearFlag(IndexValue.Flags.Delete_Index); newValue.clearOriginalMessageOffset(); addToIndex(new IndexEntry(id, newValue, null), fileSpan); return newValue; }