SVNKit not able to perform commit from application

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SVNKit not able to perform commit from application

chandansaikia
This post has NOT been accepted by the mailing list yet.
I am trying to commit new files from my local to a remote SVN Server. This is done through Java Application Using SVNKit.
Code
 private String commitToSVN(String filePath, String oldContent,
        String newContent) throws SVNException {
    String urlPath = "svn://svn_url.in:868/svn/name/ca"
    String name = applicationService.getSvnUserName();
    String password = applicationService.getPassword();
    SVNURL url = SVNURL.parseURIEncoded(urlPath);

    SVNRepository repository = SVNRepositoryFactory.create(url);
    ISVNAuthenticationManager authManager = SVNWCUtil
            .createDefaultAuthenticationManager(name,
                    password.toCharArray());
    repository.setAuthenticationManager(authManager);
    SVNNodeKind nodeKind = repository.checkPath("", -1);
    if (nodeKind == SVNNodeKind.NONE) {
        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                "No entry at URL ''{0}''", url);
        throw new SVNException(err);
    } else if (nodeKind == SVNNodeKind.FILE) {
        SVNErrorMessage err = SVNErrorMessage
                .create(SVNErrorCode.UNKNOWN,
                        "Entry at URL ''{0}'' is a file while directory was expected",
                        url);
        throw new SVNException(err);
    }
    long latestRevision = repository.getLatestRevision();
    System.out.println("Repository latest revision (before committing): "
            + latestRevision);
    ISVNEditor editor = repository.getCommitEditor(
            "directory and file added", null);
    SVNURL svnUrl = SVNURL.parseURIEncoded(urlPath);
    SVNURL fileUrl = svnUrl.appendPath(filePath, false);
    SVNRepository repos = SVNRepositoryFactory.create(fileUrl);
    SVNNodeKind nodeKindFile = repos.checkPath("",
            repos.getLatestRevision());
    SVNCommitInfo commitInfo = null;
    if (nodeKindFile == SVNNodeKind.NONE) {
        commitInfo = addFile(editor, filePath, newContent.getBytes());
    } else if (nodeKindFile == SVNNodeKind.FILE) {
        commitInfo = modifyFile(editor, filePath, oldContent.getBytes(),
                newContent.getBytes());
    }
    return repos.getLatestRevision() + "";
}
The Problem is that when I try to commit through the application it throws an error :
org.tmatesoft.svn.core.SVNException: svn: E210004: Handshake failed, data stream ended unexpectedly
This error is throwing at Line:
SVNNodeKind nodeKind = repository.checkPath("", -1);

And again whenever I use the the url as :
"http://svn_url.in:868/svn/name/ca"
the error is:
svn: E170001: OPTIONS of '/svn/name/ca/16.xml': 401 Authorization Required (http://svn_url.in:868)
Loading...