zoukankan      html  css  js  c++  java
  • 搜索树SVN的树的时候遇到的乱码问题

    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();

  • 相关阅读:
    《Programming WPF》翻译 第6章 3.二进制资源
    《Programming WPF》翻译 第5章 前言
    谈谈粒子系统
    GameFramework的初步设计
    引擎层次化设计
    关于HeapCreate(1)
    新的引擎ZeusEngine
    最短路径算法介绍
    Max导出插件
    游戏中的光影效果
  • 原文地址:https://www.cnblogs.com/wangjiyuan/p/wenti.html
Copyright © 2011-2022 走看看