if (header == null) {
header = new HTTPHeader();
}
header.setHeaderValue(HTTPHeader.SVN_OPTIONS_HEADER, "lock-steal");
}
DAVGetLockHandler handler = new DAVGetLockHandler();
SVNErrorMessage context = SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Lock request failed");
HTTPStatus status = myHttpConnection.request("LOCK", path, header, body, -1, 0, null, handler, context);
if (status.getError() != null) {
SVNErrorManager.error(status.getError());
}
if (status != null) {
String userName = myHttpConnection.getLastValidCredentials() != null ? myHttpConnection.getLastValidCredentials().getUserName() : null;
String created = status.getHeader().getFirstHeaderValue(HTTPHeader.CREATION_DATE_HEADER);
if (userName == null || created == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_DAV_MALFORMED_DATA, "Incomplete lock data returned");
SVNErrorManager.error(err);
}
Date createdDate = created != null ? SVNTimeUtil.parseDate(created) : null;
return new SVNLock(info.baselinePath, handler.getID(), userName, comment, createdDate, null);
}
return null;
}