Program
-----------------------------------------------------------------------------------------------
package com.svnkittest;
import java.io.File;
import java.io.FileInputStream;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
import org.tmatesoft.svn.core.io.ISVNEditor;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
public class SVNTest
{
private SVNRepository repository = null;
private void setup(String url, String userId, String password) throws
SVNException
{
DAVRepositoryFactory.setup();
SVNRepositoryFactoryImpl.setup();
FSRepositoryFactory.setup();
repository =
SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager(userId, password);
repository.setAuthenticationManager(authManager);
}
public void checkin(String a_Repository, String a_UserId, String
a_Password,
String a_SCMFile, String a_LocalPath, String a_Comments)
{
ISVNEditor w_editor = null;
FileInputStream w_fileReader = null;
try
{
setup(a_Repository, a_UserId, a_Password);
a_SCMFile = a_SCMFile.replaceAll("\\\\", "/");
File w_file = new File(a_LocalPath);
if (w_file.exists())
{
// Unused: long size = w_file.length();
w_fileReader = new FileInputStream(w_file);
String dirUrl = "";
int index = a_SCMFile.lastIndexOf("/");
if (index != -1)
dirUrl = a_SCMFile.substring(0, index);
w_editor =
repository.getCommitEditor(a_Comments, null);
SVNDeltaGenerator deltaGenerator = new
SVNDeltaGenerator();
w_editor.openRoot(-1);
w_editor.openDir(dirUrl, -1);
w_editor.openFile(a_SCMFile, -1);
w_editor.applyTextDelta(a_SCMFile, null);
String chksm =
deltaGenerator.sendDelta(a_SCMFile, w_fileReader,
w_editor, true);
w_editor.textDeltaEnd(a_SCMFile);
w_editor.closeFile(a_SCMFile, chksm);
/*
* Closes the directory.
*/
w_editor.closeDir();
/*
* Closes the root directory.
*/
w_editor.closeDir();
w_editor.closeEdit();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void svnProtocol()
{
String a_Repository = "svn://mandriva";
String a_UserId = "kkadam";
String a_Password = "kkadam";
String a_SCMFile = "\\a1.txt";
String a_LocalPath = "E:\\checkoutfolder\\svn\\a1.txt.";
String a_Comments = "from java";
checkin(a_Repository, a_UserId, a_Password, a_SCMFile,
a_LocalPath,
a_Comments);
}
public void httpsProtocol()
{
String a_Repository =
"https://rock.digite.in:8443/svn/Dev/trunk";
String a_UserId = "nsawant";
String a_Password = "welcome@1";
String a_SCMFile = "\\a1.txt";
String a_LocalPath = "E:\\checkoutfolder\\svn\\a1.txt.";
String a_Comments = "from java";
checkin(a_Repository, a_UserId, a_Password, a_SCMFile,
a_LocalPath,
a_Comments);
}
public static void main(String[] a)
{
new SVNTest().
svnProtocol();
//httpsProtocol();
}
}
With this program, https:// protocol is working fine but svn:// protocol is
failing with following exception
-----------------------------------------------------------------------------------------------
org.tmatesoft.svn.core.SVNException: svn: Malformed network data
at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
at
org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
at
org.tmatesoft.svn.core.internal.io.svn.SVNReader.readChar(SVNReader.java:478)
at
org.tmatesoft.svn.core.internal.io.svn.SVNReader.skipWhiteSpace(SVNReader.java:485)
at
org.tmatesoft.svn.core.internal.io.svn.SVNReader.readTuple(SVNReader.java:287)
at
org.tmatesoft.svn.core.internal.io.svn.SVNReader.parse(SVNReader.java:241)
at
org.tmatesoft.svn.core.internal.io.svn.SVNConnection.read(SVNConnection.java:260)
at
org.tmatesoft.svn.core.internal.io.svn.SVNCommitEditor.closeEdit(SVNCommitEditor.java:203)
at com.svnkittest.SVNTest.checkin(SVNTest.java:79)
at com.svnkittest.SVNTest.svnProtocol(SVNTest.java:98)
at com.svnkittest.SVNTest.main(SVNTest.java:117)
When I debugged with SVNKit source, in method SVNReader.readChar(InputStream
is),
at line is.read() following exception occcurred :
-----------------------------------------------------------------------------------------------
java.net.SocketException: Software caused connection abort: recv failed
SVNKit Log with svn:// protocol
---------------------
Jun 21, 2011 11:08:26 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops
depth log-revprops partial-replay ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( 2 ( edit-pipeline svndiff1 absent-entries depth mergeinfo log-revprops )
14:svn://mandriva )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( ( ANONYMOUS CRAM-MD5 ) 13:My Repository ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINE: NETWORK:
org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( ANONYMOUS ( 0: ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( 36:6aebf4cc-cb63-4a4e-8b4b-cf6a32a8c924 14:svn://mandriva (
mergeinfo ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( commit ( 9:from java ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( ( CRAM-MD5 ) 13:My Repository ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINE: NETWORK:
org.tmatesoft.svn.core.internal.io.svn.sasl.SVNSaslAuthenticator
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( CRAM-MD5 ( ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( step ( 57:<[email protected]> ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
39:kkadam 18c1b006e4d807bd6065e96ba9813e39
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: READ
( success ( ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( open-root ( ( ) 2:d0 ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( open-dir ( 0: 2:d0 2:d1 ( ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( open-file ( 7:/a1.txt 2:d1 2:c2 ( ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( apply-textdelta ( 2:c2 ( ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-chunk ( 2:c2
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
4:SVN ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-chunk ( 2:c2
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
7: ?;?= ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-chunk ( 2:c2
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
4:??; ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-chunk ( 2:c2
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
189:?;update itemauditlog
set description =
replace(replace(replace(description, '?', '#1s1#'), '?', '#2s2#'), 'Ø',
'#2s2#')
where objecttype in ('AdminPref', 'ProjPref', 'UserPref');
aaa ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-end ( 2:c2 ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( textdelta-end ( 2:c2 ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( close-file ( 2:c2 ( 32:3461edb16339b0f5bf27235f8c51c36d ) ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( close-dir ( 2:d1 ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( close-dir ( 2:d0 ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( close-edit ( ) )
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINE: NETWORK: svn: Malformed network data
Jun 21, 2011 11:08:27 AM
org.tmatesoft.svn.core.internal.util.DefaultSVNDebugLogger log
FINEST: SENT
( abort-edit ( ) )
What could be the reason for failing commit in svn:// protocol repository ?
Program
--
View this message in context:
http://old.nabble.com/svn%3A-Malformed-network-data-with-svn%3A---protocol-repository-tp31891594p31891594.html
Sent from the SVNKit - Users mailing list archive at Nabble.com.