Java JCIFS JCIFS.smb.smbFileRename不喜欢像“&”这样的特殊字符

Java JCIFS JCIFS.smb.smbFileRename不喜欢像“&”这样的特殊字符,java,apache-camel,jcifs,Java,Apache Camel,Jcifs,在通过ApacheCamel使用jcifs对名称包含“&”字符的远程Windows共享进行操作时,我遇到了一个问题。其根本原因是jcifs在重命名远程文件时显然不能很好地处理“&”字符,而Windows对此没有问题 public class SmbFileTest { @Test public void testAmperstand() throws Exception { String targetLocation = "smb://user:pass@hos

在通过ApacheCamel使用jcifs对名称包含“&”字符的远程Windows共享进行操作时,我遇到了一个问题。其根本原因是jcifs在重命名远程文件时显然不能很好地处理“&”字符,而Windows对此没有问题

public class SmbFileTest {

    @Test
    public void testAmperstand() throws Exception {
        String targetLocation = "smb://user:pass@host/share/hello&goodbye";
        SmbFile targetLocationFile = new SmbFile(targetLocation);
        if(!targetLocationFile.exists()){
            targetLocationFile.mkdirs();
        }
        SmbFile smbFile = new SmbFile(targetLocation+"/to.tmp");
        IOUtils.write("content",smbFile.getOutputStream());
        SmbFile smbFileDest = new SmbFile(targetLocation+"/to.txt");
        smbFile.renameTo(smbFileDest);
    }
}

上述测试失败jcifs 1.3.17在重命名之前尝试关闭输出流smbFile.getOutputStream

有人知道如何重命名Smb目录吗?因为只重命名一个SMB文件会创建一个新目录,但它不包含原始文件的子目录是的,你已经搞定了!谢谢
jcifs.smb.SmbException: The process cannot access the file because it is being used by another process.