private void end(HttpClient client, boolean commit) throws RepositoryException {
checkConsumed();
String uri = getItemUri(targetId, sessionInfo);
UnLockMethod method = null;
try {
// make sure the lock initially created is removed again on the
// server, asking the server to persist the modifications
method = new UnLockMethod(uri, batchId);
initMethod(method, sessionInfo, true);
// in contrast to standard UNLOCK, the tx-unlock provides a
// request body.
method.setRequestBody(new TransactionInfo(commit));
client.executeMethod(method);
method.checkSuccess();
if (sessionInfo instanceof SessionInfoImpl) {
((SessionInfoImpl) sessionInfo).setLastBatchId(batchId);
}
if (clear) {
clearItemUriCache(sessionInfo);
}
} catch (IOException e) {
throw new RepositoryException(e);
} catch (DavException e) {
throw ExceptionConverter.generate(e);
} finally {
if (method != null) {
// release UNLOCK method
method.releaseConnection();
}
}
}