-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 に答える