-3

我无法使用编辑器在存储库中添加任何文件,它java.lang.NullPointerException在行抛出异常editor.addFile(textfile, null, -1);

try {
    url = "https://XXX.yyy.zzzz";
    SVNRepository repository = null;
    String name = "testuser";
    String password = "testuserpassword";
    repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
    ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password);
    repository.setAuthenticationManager(authManager);
    System.out.println(repository.getLatestRevision());

    SVNClientInterface client = SVNClientImpl.newInstance();
} catch (Exception e) {
    System.out.println("error");
}               

try { 
    ISVNEditor editor = repository.getCommitEditor("This is a log message.", new CommitMediator()); 

    editor.openRoot(-1); 
    System.out.println("in DAV");
    editor.addFile(textfile, null, -1);
    editor.addFile("file1.txt", null, -1);       
    editor.applyTextDelta("file1.txt", null); 
    OutputStream os=null;
    os.close(); 
    editor.textDeltaEnd(file1.txt); 
    editor.closeFile(file1.txt, null); 
    editor.closeEdit(); 
} catch(Exception e) {
    System.out.println(e);
}
4

1 回答 1

0
editor.addFile(textfile, null, -1);

是什么textfile

OutputStream os=null;
os.close();

可能想想想那里发生了什么。

于 2012-01-11T04:28:47.257 回答