I'm trying to determine whether or not a file is locked, and if so, what the username of the lock's owner is. Here's what I've tried so far:
=======================================================================
SvnRepositoryGetLock svnRepositoryGetLock
= svnOperationFactory.createRepositoryGetLock();
String workingCopyDirPath = workingCopyDir.getAbsolutePath();
SvnTarget fileTarget = SvnTarget.fromFile(requestedFile);
svnRepositoryGetLock.setSingleTarget(fileTarget);
svnRepositoryGetLock.setPath(workingCopyDirPath);
SVNLock svnLock = svnRepositoryGetLock.run();
return (svnLock == null ? null : svnLock.getOwner());
Unfortunately, it's not working. It produces this error:
Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: E160004:
Can't read length line from file format: format (No such file or directory)
at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:85)
at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:69)
at
org.tmatesoft.svn.core.internal.io.fs.FSFile.readLine(FSFile.java:137)
at org.tmatesoft.svn.core.internal.io.fs.FSFile.readInt(FSFile.java:101)
at org.tmatesoft.svn.core.internal.io.fs.FSFS.openRoot(FSFS.java:237)
at org.tmatesoft.svn.core.internal.io.fs.FSFS.open(FSFS.java:197)
at
org.tmatesoft.svn.core.internal.wc.SVNAdminHelper.openRepository(SVNAdminHelper.java:77)
at
org.tmatesoft.svn.core.wc.admin.SVNLookClient.open(SVNLookClient.java:1253)
at
org.tmatesoft.svn.core.wc.admin.SVNLookClient.doGetLock(SVNLookClient.java:674)
at
org.tmatesoft.svn.core.internal.wc2.admin.SvnRepositoryGetLockImpl.run(SvnRepositoryGetLockImpl.java:16)
at
org.tmatesoft.svn.core.internal.wc2.admin.SvnRepositoryGetLockImpl.run(SvnRepositoryGetLockImpl.java:9)
at
org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
at
org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291)
at com.iii.app.SvnSget.getLockOwner(SvnSget.java:127)
at com.iii.app.SvnSget.main(SvnSget.java:83)
Caused by: java.io.FileNotFoundException: format (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at
org.tmatesoft.svn.core.internal.wc.SVNFileUtil.createFileInputStream(SVNFileUtil.java:1680)
at
org.tmatesoft.svn.core.internal.io.fs.FSFile.getChannel(FSFile.java:393)
at org.tmatesoft.svn.core.internal.io.fs.FSFile.fill(FSFile.java:373)
at org.tmatesoft.svn.core.internal.io.fs.FSFile.read(FSFile.java:295)
at
org.tmatesoft.svn.core.internal.io.fs.FSFile.readLine(FSFile.java:124)
... 13 more
So, how far off am I? Am I right to use SvnRepositoryGetLock, or should I be
attacking this some other way?
Thanks for any help,
Andy
Andy Cohen
Principal Software Engineer
Product Development
Innovative Interfaces, Inc.
5850 Shellmound Way
Emeryville, CA 94608
[letter-t] 510-655-6200 Ext 4221
[letter-e] [email protected]
[INNOIcon]<http://www.iii.com/> [TwritterIcon]
<https://twitter.com/iii_Innovative> [FacebookIcon]
<https://www.facebook.com/InnovativeInterfaces>
<<inline: image001.jpg>>
<<inline: image002.jpg>>
<<inline: image003.jpg>>
<<inline: image004.jpg>>
<<inline: image005.jpg>>
