Well, so I'm getting this error:
Exception in thread "main" java.lang.Error: SVNRepository methods are not
reenterable
at
org.tmatesoft.svn.core.io.SVNRepository.lock(SVNRepository.java:2820)
at
org.tmatesoft.svn.core.io.SVNRepository.lock(SVNRepository.java:2811)
at
org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1011)
at
org.tmatesoft.svn.core.internal.io.dav.DAVRepository.checkPath(DAVRepository.java:219)
What I'm trying to do is implement something similar to and import. I have
a file that contains a list of files that need to be
put in the repository. I would like to do them all with one revision. So,
I have the following code:
repository = SVNRepositoryFactory.create (url);
latestRevision = repository.getLatestRevision();
ISVNEditor editor = repository.getCommitEditor(msg, null);
editor.openRoot(-1);
while ((rec = buffReader.readLine()) != null) {
// Pull the filename out of rec.
// Construct the following variables
// dirPath = "Folder"
// filePath = "Folder/Filename.txt"
// modifiedContents = <a byte array containing contents of file>
nodeKind = repository.checkPath (dirPath, -1); // "Folder" <== This dies
immediately
if (nodeKind == SVNNodeKind.NONE) {
editor.addDir (dirPath, null, -1);
nodeKind = repository.checkPath(filePath, -1);
boolean fileIsInRepository = (nodeKind==SVNNodeKind.FILE);
if (fileIsInRepository) {
SVNProperties props = new SVNProperties();
repository.getFile(filePath
,-1
,props
,existingStream
);
contents = existingStream.toByteArray();
// contents now has the data from the repository
}
}
editor.openDir (dirPath, -1);
editor.addFile (filePath, null, -1);
editor.applyTextDelta (filePath, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator
(diffWindowSize);
String checksum = null;
if (fileIsInRepository) {
checksum = deltaGenerator.sendDelta(filePath
,new ByteArrayInputStream (contents)
,0
,new ByteArrayInputStream (modifiedContents)
,editor
,true // generateChecksum
);
} else {
checksum = deltaGenerator.sendDelta (filePath
,new ByteArrayInputStream (modifiedContents)
,editor
,true // generateChecksum
);
}
// Multiple editor.changeFileProperty calls
editor.closeFile (filePath, checksum);
editor.closeDir();
} // while
editor.closeDir();
editor.closeEdit();
latestRevision = repository.getLatestRevision();
One idea I had was to construct a second repository object
(inquiryRepository) that is
just used for my "checkPath" calls.
But I thought I would check with the group first. Is there any info
written up somewhere
that talks about re-entrance and its implications?
Don Payette
FSS19 Production Management
Contractor for the GSA FAME Program
2345 Crystal Dr. Suite 250, Rm 208A.
(w) 703-236-3523
(c) 571-305-0105
(h) 479-437-3084 - telework Monday and Wednesday
Internal only extension 7706