document = oldDoc;
oldDocLocked = false;
}
if (LOG.isDebugEnabled())
LOG.debug("removed old document " + oldDoc.getFileURI());
<BUG>} else {
document.getUpdateLock().acquire(Lock.WRITE_LOCK);</BUG>
document.setDocId(broker.getNextResourceId(transaction, this));
addDocument(transaction, broker, document);
}

document = oldDoc;
oldDocLocked = false;
}
if (LOG.isDebugEnabled())
LOG.debug("removed old document " + oldDoc.getFileURI());
} else {
if (transaction != null)
transaction.acquireLock(document.getUpdateLock(), Lock.WRITE_LOCK);
else
document.getUpdateLock().acquire(Lock.WRITE_LOCK);
document.setDocId(broker.getNextResourceId(transaction, this));
addDocument(transaction, broker, document);
}
