我不能使用編輯器,它是在拋繩一個java.lang.NullPointerException
例外添加任何服務器中的資源editor.addFile(textfile, null, -1);
使用SVN套件無法添加文件存儲庫和下面的代碼是投擲顯示java.lang.NullPointerException
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);
}
我不能使用編輯器在存儲庫中添加任何文件,它會在「editor.addFile(textfile,null,-1)」行中拋出java.lang.NullPointerException異常;「預先感謝 – user1118693 2012-01-11 04:22:09
'os。 close();在'OutputStream os = null;'之後'肯定意味着'NullPointerException'。 – javanna 2012-01-11 12:49:41
如果你不想使用log4j或其他東西進行日誌記錄,請至少用'e.printStackTrace();'替換'System.out.println(e);'! – javanna 2012-01-11 12:51:12