Search code examples
javasvnkit

SVN KIT commit comments issue


I am using SVNKIT to commit changes in SVN. it is running fine as expected in java. problem is comments are not being saved in svn. i am doing something like below:

String comment = "testing here";
ISVNEditor editor = repository.getCommitEditor(comment, null /*locks*/ , false /*keepLocks*/ , null /*mediator*/ );
SVNCommitInfo commitInfo = modifyFile(editor, "", "filePath", contents, modifiedContents);

and modifyFile methos is like below

 private static SVNCommitInfo modifyFile(ISVNEditor editor, String dirPath,
            String filePath, byte[] oldData, byte[] newData) throws SVNException {

        editor.openRoot(-1);
        editor.openDir(dirPath, -1);
        editor.openFile(filePath, -1);
        editor.applyTextDelta(filePath, null);
        SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
        String checksum = deltaGenerator.sendDelta(filePath, new ByteArrayInputStream(oldData), 0, new ByteArrayInputStream(newData), editor, true);

        editor.closeFile(filePath, checksum);
        editor.closeDir();
        editor.closeDir();

        return editor.closeEdit();
    }

i am not able to find the mistake as to why comments are not being saved. maven entry for same is -

<groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.8.11</version>

Solution

  • ok, thanks to one of my intelligent teammate, i found the solution. there seems to be a bug in 1.8.11 version and it doesn't allow comments to be saved. i changed the version in pom.xml to 1.7.5 and it works like anything.

    No change in code was done. might be helpful to others who are struggling with same issue