if (id == null) {
Object[] buffer = new Object[] { "get-lock", path };
write("(w(s))", buffer);
authenticate();
read("[((?L))]", buffer, true);
SVNLock lock = (SVNLock) buffer[0];
if (lock == null) {
lock = new SVNLock(path, "", null, null, null, null);
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''", path);
handler.handleUnlock(path, lock, err);
continue;
}
id = lock.getID();
}
Object[] buffer = new Object[] { "unlock", path, id, Boolean.valueOf(force) };
write("(w(s(s)w))", buffer);
authenticate();
SVNErrorMessage error = null;
try {
read("[()]", buffer, true);
} catch (SVNException e) {
if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_LOCKED) {
error = e.getErrorMessage();
error = SVNErrorMessage.create(error.getErrorCode(), error.getMessageTemplate(), path);
} else {
throw e;
}
}
if (handler != null) {
SVNLock lock = new SVNLock(path, id, null, null, null, null);
handler.handleUnlock(path, lock, error);
}
}
}