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

时间:2023-03-10 03:29:02
搜索树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 = ; i < finalPath.length; i++) {
currentPath += finalPath[i] + "/";
}
root = repository.getDir(currentPath, -, 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();

相关文章