dstPath = new File(dstPath, PathUtil.decode(PathUtil.tail(url)));
dstPath = new File(dstPath, SVNEncodingUtil.uriDecode(PathUtil.tail(url)));
    public long doExport(String url, File dstPath, SVNRevision pegRevision,            SVNRevision revision, String eolStyle, boolean force,            boolean recursive) throws SVNException {        url = validateURL(url);        if (dstPath == null) {            dstPath = new File(".", PathUtil.tail(url));        }        if (!revision.isValid() && !pegRevision.isValid()) {            pegRevision = SVNRevision.HEAD;            revision = SVNRevision.HEAD;        } else if (!revision.isValid()) {            revision = pegRevision;        } else if (!pegRevision.isValid()) {            pegRevision = revision;        }        url = getURL(url, pegRevision, revision);        SVNRepository repos = createRepository(url);        final long revNumber = getRevisionNumber(url, revision);        SVNNodeKind targetNodeKind = repos.checkPath("", revNumber);        if (targetNodeKind == SVNNodeKind.FILE) {            if (dstPath.isDirectory()) {                dstPath = new File(dstPath, PathUtil.decode(PathUtil.tail(url)));            }            if (dstPath.exists()) {                if (!force) {                    SVNErrorManager.error("svn: '" + dstPath + "' already exists");                }            } else {                dstPath.getParentFile().mkdirs();            }            Map properties = new HashMap();            OutputStream os = null;            File tmpFile = SVNFileUtil.createUniqueFile(                    dstPath.getParentFile(), dstPath.getName(), ".tmp");            os = SVNFileUtil.openFileForWriting(tmpFile);            try {                repos.getFile("", revNumber, properties, os);            } finally {                SVNFileUtil.closeFile(os);            }            if (force && dstPath.exists()) {                SVNFileUtil.deleteAll(dstPath);            }            Map keywords = SVNTranslator                    .computeKeywords((String) properties                            .get(SVNProperty.KEYWORDS), url,                            (String) properties                                    .get(SVNProperty.LAST_AUTHOR),                            (String) properties                                    .get(SVNProperty.COMMITTED_DATE),                            (String) properties                                    .get(SVNProperty.COMMITTED_REVISION));            if (eolStyle == null) {                eolStyle = (String) properties.get(SVNProperty.EOL_STYLE);            }            byte[] eols = SVNTranslator.getWorkingEOL(eolStyle);            SVNTranslator.translate(tmpFile, dstPath, eols, keywords,                    properties.get(SVNProperty.SPECIAL) != null, true);            tmpFile.delete();            if (properties.get(SVNProperty.EXECUTABLE) != null) {                SVNFileUtil.setExecutable(dstPath, true);            }            dispatchEvent(SVNEventFactory.createExportAddedEvent(dstPath                    .getParentFile(), dstPath, SVNNodeKind.FILE));        } else if (targetNodeKind == SVNNodeKind.DIR) {            SVNExportEditor editor = new SVNExportEditor(this, url, dstPath,                    force, eolStyle);            repos.update(revNumber, null, recursive, new ISVNReporterBaton() {                public void report(ISVNReporter reporter) throws SVNException {                    reporter.setPath("", null, revNumber, true);                    reporter.finishReport();                }            }, editor);            if (!isIgnoreExternals() && recursive) {                Map externals = editor.getCollectedExternals();                for (Iterator files = externals.keySet().iterator(); files                        .hasNext();) {                    File rootFile = (File) files.next();                    String propValue = (String) externals.get(rootFile);                    if (propValue == null) {                        continue;                    }                    SVNExternalInfo[] infos = SVNWCAccess.parseExternals("",                            propValue);                    for (int i = 0; i < infos.length; i++) {                        File targetDir = new File(rootFile, infos[i].getPath());                        String srcURL = infos[i].getOldURL();                        SVNRevision srcRevision = SVNRevision.create(infos[i]                                .getOldRevision());                        String relativePath = targetDir.getAbsolutePath()                                .substring(dstPath.getAbsolutePath().length());                        relativePath = relativePath.replace(File.separatorChar,                                '/');                        relativePath = PathUtil                                .removeLeadingSlash(relativePath);                        relativePath = PathUtil                                .removeTrailingSlash(relativePath);                        dispatchEvent(SVNEventFactory                                .createUpdateExternalEvent(null, relativePath));                        try {                            setEventPathPrefix(relativePath);                            doExport(srcURL, targetDir, srcRevision,                                    srcRevision, eolStyle, force, recursive);                        } catch (Throwable th) {                            dispatchEvent(new SVNEvent(th.getMessage()));                        } finally {                            setEventPathPrefix(null);                        }                    }                }            }        }        dispatchEvent(SVNEventFactory.createUpdateCompletedEvent(null,                revNumber));        return revNumber;    }