搜索树SVN的树的时候遇到的乱码问题

来源:互联网 发布:linux合并文件 编辑:程序博客网 时间:2024/04/30 04:43
public void listDirectoryNode(SVNRepository repository, String dirUrl, FileNode node) {        String currentPath = "";        List list = new ArrayList();        Collection root;        try {            String finalPath[] = dirUrl.split("/");            for (int i = 5; i < finalPath.length; i++) {                currentPath += finalPath[i] + "/";            }            root = repository.getDir(currentPath, -1, null, (Collection) null);            Iterator iterator = root.iterator();            while (iterator.hasNext()) {                SVNDirEntry entry = (SVNDirEntry) iterator.next();                if (entry.getKind() == SVNNodeKind.DIR) {                    FileNode subDirNode = new FileNode(entry.getName(), entry                            .getURL().toDecodedString(), entry.getRevision(),                            entry.getAuthor(), entry.getSize(),                            entry.getDate(), null, entry.getKind());                    listDirectoryNode(repository, entry.getURL().toDecodedString(), subDirNode);                    list.add(subDirNode);                }             }        } catch (SVNException e) {            // TODO Auto-generated catch block            e.printStackTrace();        }        node.setChildren(list);    }

在entry.getURL().toString();的时候,当地址是以http://开头的话会出现乱码。原因是http的安全地址机制,这样写的话就没有问题了:entry.getURL().toDecodedString();

0 0
原创粉丝点击