handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.UNLOCK_FAILED, null, "unlock failed"), ISVNEventHandler.UNKNOWN); } else {
handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.UNLOCK_FAILED, null, error.getMessage()), ISVNEventHandler.UNKNOWN); } if (lock != null) {
    public void doUnlock(File[] paths, boolean breakLock) throws SVNException {        final Map entriesMap = new HashMap();        for (int i = 0; i < paths.length; i++) {            SVNWCAccess wcAccess = createWCAccess(paths[i]);            try {                wcAccess.open(true, false);                SVNEntry entry = wcAccess.getTargetEntry();                if (entry == null) {                    SVNErrorManager.error("svn: '" + paths[i] + "' is not under version control");                }                if (entry.getURL() == null) {                    SVNErrorManager.error("svn: '" + entry.getName() + "' has no URL");                }                String lockToken = entry.getLockToken();                if (!breakLock && lockToken == null) {                    SVNErrorManager.error("svn: '" + entry.getName() + "' is not locked in this working copy");                }                entriesMap.put(entry.getSVNURL(),  new LockInfo(paths[i], lockToken));                wcAccess.getAnchor().getEntries().close();            } finally {                wcAccess.close(true);            }        }        SVNURL[] urls = (SVNURL[]) entriesMap.keySet().toArray(new SVNURL[entriesMap.size()]);        Collection urlPaths = new HashSet();        final SVNURL topURL = SVNURLUtil.condenceURLs(urls, urlPaths, false);        if (urlPaths.isEmpty()) {            urlPaths.add("");        }        if (topURL == null) {            SVNErrorManager.error("svn: Paths belong to different repositories");        }        Map pathsTokensMap = new HashMap();        for(Iterator encodedPaths = urlPaths. iterator(); encodedPaths.hasNext();) {            String encodedPath = (String) encodedPaths.next();            SVNURL fullURL = topURL.appendPath(encodedPath, true);            LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);            encodedPath = SVNEncodingUtil.uriDecode(encodedPath);            pathsTokensMap.put(encodedPath, lockInfo.myToken);        }        checkCancelled();        SVNRepository repository = createRepository(topURL, true);        final SVNURL rootURL = repository.getRepositoryRoot(true);        repository.unlock(pathsTokensMap, breakLock, new ISVNLockHandler() {            public void handleLock(String path, SVNLock lock, SVNException error) throws SVNException {            }            public void handleUnlock(String path, SVNLock lock, SVNException error) throws SVNException {                SVNURL fullURL = rootURL.appendPath(path, false);                LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);                SVNWCAccess wcAccess = createWCAccess(lockInfo.myFile);                if (error != null) {                    handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.UNLOCK_FAILED, null, "unlock failed"),                             ISVNEventHandler.UNKNOWN);                } else {                    try {                        wcAccess.open(true, false);                        SVNEntry entry = wcAccess.getAnchor().getEntries().getEntry(                                wcAccess.getTargetName(), true);                        entry.setLockToken(null);                        entry.setLockComment(null);                        entry.setLockOwner(null);                        entry.setLockCreationDate(null);                        wcAccess.getAnchor().getEntries().save(true);                        wcAccess.getAnchor().getEntries().close();                        if (wcAccess.getAnchor().getProperties(entry.getName(), false).getPropertyValue(SVNProperty.NEEDS_LOCK) != null) {                            SVNFileUtil.setReadonly(wcAccess.getAnchor().getFile(entry.getName()), true);                        }                        handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.UNLOCKED, lock, null),                                ISVNEventHandler.UNKNOWN);                    } finally {                        wcAccess.close(true);                    }                }            }        });    }