0

Couldn't commit a modified file to SVN repository using SVNKit libraries in Java. No stack Trace information is available for me to debug which is disappointing.

The file is modified using a Java program and I would have to commit the modified file using SVN. (svn commit -m "Updated").

The file has been modified and appears as below when I run 'svn status' command.

svn status filename

M filename

here is my code:

try {
String url = "http://repository URL";
File file = new File("<path to file>"+inputFile);

DAVRepositoryFactory.setup();
SVNURL svnurl = SVNURL.parseURIDecoded(url);
SVNCommitInfo commitInfo;
String uname = <username>; // auth details to connect to SVN repo
String pwd = <password>;

pw.println("<br> SVN URL is : "+ svnurl); //pw is a reference object of response.getWriter()
DAVRepository repo = (DAVRepository) DAVRepositoryFactory.create(svnurl);
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(uname, pwd);
repo.setAuthenticationManager(authManager);

long latestRevision = repo.getLatestRevision();
pw.println("<br> LATEST REVISION IS : "+latestRevision);
/*
SVNClientManager clientManager = SVNClientManager.newInstance(null,repo.getAuthenticationManager());
try {
SVNUpdateClient uc = clientManager.getUpdateClient();
uc.doUpdate(file, SVNRevision.HEAD, true);
SVNCommitClient cc = clientManager.getCommitClient();
commitInfo = cc.doCommit(new File[] {file}, false, "Updated regex", null, null, false, false,          SVNDepth.INFINITY);
pw.println("<br> COMMIT INFORMATION : "+commitInfo);
} finally {
clientManager.dispose();
}
*/
} catch (Exception e) {
pw.println(e.getMessage());
}

My output: SVN URL is : repository URL [Ljava.lang.StackTraceElement;@1e610e3 (and the modified file is not committed)

Any help is appreciated. Thanks

DigitalDyn
  • 165
  • 2
  • 3
  • 12

0 Answers0