Hello,

I want to update a file in a https SVN Repository using SVNKit, but I am
always getting an org.tmatesoft.svn.core.SVNAuthenticationException that the
CHECKOUT of the file which I want to update is not allowed (403 Forbidden).

Please have a look at following authz file:


[groups]
intern = admin
extern = sandro

[/]
@intern = rw
* = r

[/readonly]
@extern = r

[/readonly/readwrite]
@extern = rw

[/noread]
@extern = 


The user "sandro" is only allowed to write in the directory
"/readonly/readwrite". And this is the directory where I want to update a
file. Add a file, delete a file, copy a file...everything is working, except
updating.

Following code will return:
SCHWERWIEGEND: null
org.tmatesoft.svn.core.SVNAuthenticationException: svn: CHECKOUT of
'/svn/S_Test/!svn/ver/11/readwrite/Test.txt': 403 Forbidden
(https://UrlToRepository.server/)

Please have a look:

    public static void main(String[] args) {
        DAVRepositoryFactory.setup();
        SVNRepository repository = null;        
        try {
            repository =
SVNRepositoryFactory.create(SVNURL.parseURIEncoded("https://UrlToRepository.server/svn/S_Test";));
            ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager( "sandro", "sandro" );      
            repository.setAuthenticationManager(authManager);
            repository.testConnection();
            File file = new File("c:/TEMP/test.txt");
            String filename = file.getName();
            if (file.exists()) {
                String url = "readonly/readwrite/Test.txt";
                SVNURL[] svnurl = new SVNURL[1];
                svnurl[0] = repository.getLocation();
                svnurl[0] = svnurl[0].appendPath(url, false);
                long size = file.length();
                InputStream fileReader = new FileInputStream(file);
                String dirUrl = UrlUtil.getPreviousFullPath(url);
                ISVNEditor editor = repository.getCommitEditor("test", null);
                SVNCommitInfo commitInfo = SVNUtils.modifyFile(editor, dirUrl, 
url,
fileReader, size);
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE,
null, ex);
        } catch (SVNException ex) {
            Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE,
null, ex);
        } finally {
            if (repository != null) {
                repository.closeSession();
            }

        }
    }


Whats wrong here? I have no idea whats the reason of this behavior. With
SmartSVN or Tortois everything is working fine.


Thanks for any help!


Regards,
Sandro

-- 
View this message in context: 
http://old.nabble.com/Could-not-update-file--%3E-CHECKOUT-...-403-Forbidden-tp33419545p33419545.html
Sent from the SVNKit - Users mailing list archive at Nabble.com.


Reply via email to