throw new IllegalArgumentException("principal cannot be null");
}
if (principal.equals(owner)) {
if (!manager.releaseLock(resourceIdentifier, principal)) {
throw new LockException("Lock for " + resourceIdentifier +
" is not owned by " + principal.getName());
}
} else if (owner == null) {
throw new IllegalStateException(
"Lock cannot be released as it is not owned");