private List read(String template, List values, boolean readMalformedData) throws SVNException { if (myConnection == null) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED), SVNLogType.NETWORK); } return myConnection.read(template, values, readMalformedData); }
public SVNCommitInfo closeEdit() throws SVNException { SVNException e = null; try { myConnection.write("(w())", new Object[]{"close-edit"}); myConnection.read("", null, true); myRepository.authenticate(); List items = myConnection.readTuple("r(?s)(?s)?(?s)", true); long revision = SVNReader.getLong(items, 0); Date date = SVNReader.getDate(items, 1); String author = SVNReader.getString(items, 2); String errorMessage = SVNReader.getString(items, 3); SVNErrorMessage err = errorMessage == null || errorMessage.length() == 0 ? null : SVNErrorMessage.create(SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED, errorMessage, SVNErrorMessage.TYPE_WARNING); return new SVNCommitInfo(revision, author, date, err); } catch (SVNException exception) { e = exception; try { myConnection.write("(w())", new Object[]{"abort-edit"}); } catch (SVNException e1) { } throw exception; } finally { myCloseCallback.run(e); myCloseCallback = null; } }
private Object[] read(String template, Object[] values, boolean readMalformedData) throws SVNException { if (myConnection == null) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED)); } return myConnection.read(template, values, readMalformedData); }
public SVNCommitInfo closeEdit() throws SVNException { SVNException e = null; try { myConnection.write("(w())", new Object[]{"close-edit"}); myConnection.read("", null, true); myRepository.authenticate(); List items = myConnection.readTuple("r(?s)(?s)?(?s)", true); long revision = SVNReader.getLong(items, 0); Date date = SVNReader.getDate(items, 1); String author = SVNReader.getString(items, 2); String errorMessage = SVNReader.getString(items, 3); SVNErrorMessage err = errorMessage == null || errorMessage.length() == 0 ? null : SVNErrorMessage.create(SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED, errorMessage, SVNErrorMessage.TYPE_WARNING); return new SVNCommitInfo(revision, author, date, err); } catch (SVNException exception) { e = exception; try { myConnection.write("(w())", new Object[]{"abort-edit"}); } catch (SVNException e1) { } throw exception; } finally { myCloseCallback.run(e); myCloseCallback = null; } }
private List read(String template, List values, boolean readMalformedData) throws SVNException { if (myConnection == null) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED), SVNLogType.NETWORK); } return myConnection.read(template, values, readMalformedData); }
public SVNCommitInfo closeEdit() throws SVNException { SVNException e = null; try { myConnection.write("(w())", new Object[]{"close-edit"}); myConnection.read("", null, true); myRepository.authenticate(); List items = myConnection.readTuple("r(?s)(?s)?(?s)", true); long revision = SVNReader.getLong(items, 0); Date date = SVNReader.getDate(items, 1); String author = SVNReader.getString(items, 2); String errorMessage = SVNReader.getString(items, 3); SVNErrorMessage err = errorMessage == null || errorMessage.length() == 0 ? null : SVNErrorMessage.create(SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED, errorMessage, SVNErrorMessage.TYPE_WARNING); return new SVNCommitInfo(revision, author, date, err); } catch (SVNException exception) { e = exception; try { myConnection.write("(w())", new Object[]{"abort-edit"}); } catch (SVNException e1) { } throw exception; } finally { myCloseCallback.run(e); myCloseCallback = null; } }
private List read(String template, List values, boolean readMalformedData) throws SVNException { if (myConnection == null) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED), SVNLogType.NETWORK); } return myConnection.read(template, values, readMalformedData); }
public void abortEdit() throws SVNException { if (myIsAborted || myCloseCallback == null) { return; } myIsAborted = true; SVNException error = null; try { myConnection.write("(w())", new Object[]{"abort-edit"}); myConnection.read("", null, true); } catch (SVNException e) { error = e; throw e; } finally { myCloseCallback.run(error); myCloseCallback = null; } }
public void abortEdit() throws SVNException { if (myIsAborted || myCloseCallback == null) { return; } myIsAborted = true; SVNException error = null; try { myConnection.write("(w())", new Object[]{"abort-edit"}); myConnection.read("", null, true); } catch (SVNException e) { error = e; throw e; } finally { myCloseCallback.run(error); myCloseCallback = null; } }
public void abortEdit() throws SVNException { if (myIsAborted || myCloseCallback == null) { return; } myIsAborted = true; SVNException error = null; try { myConnection.write("(w())", new Object[] { "abort-edit" }); myConnection.read("[()]", null, true); } catch (SVNException e) { error = e; throw e; } finally { myCloseCallback.run(error); myCloseCallback = null; } }
public void abortEdit() throws SVNException { if (myIsAborted || myCloseCallback == null) { return; } myIsAborted = true; SVNException error = null; try { myConnection.write("(w())", new Object[]{"abort-edit"}); myConnection.read("", null, true); } catch (SVNException e) { error = e; throw e; } finally { myCloseCallback.run(error); myCloseCallback = null; } }
private SVNErrorMessage readAuthResponse(SVNRepositoryImpl repository) throws SVNException { Object[] items = read("(W(?S))", null, true); if (SUCCESS.equals(items[0])) { if (!myIsCredentialsReceived) { Object[] creds = read("[(?S?S)]", null, true); if (repository != null && repository.getRepositoryRoot(false) == null) { SVNURL rootURL = creds[1] != null ? SVNURL.parseURIEncoded((String) creds[1]) : null; repository.updateCredentials((String) creds[0], rootURL); } if (myRealm == null) { myRealm = (String) creds[0]; } if (myRoot == null) { myRoot = (String) creds[1]; } myIsCredentialsReceived = true; } return null; } else if (FAILURE.equals(items[0])) { return SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, (String) items[1]); } return SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, "unexpected server response"); }
public void authenticate(SVNRepositoryImpl repository) throws SVNException { List items = read("ls", null, true); List mechs = SVNReader.getList(items, 0); if (mechs == null || mechs.size() == 0) { return; } myRealm = SVNReader.getString(items, 1); ISVNAuthenticationManager authManager = myRepository.getAuthenticationManager(); if (authManager != null && authManager.isAuthenticationForced() && mechs.contains("ANONYMOUS") && (mechs.contains("CRAM-MD5") || mechs.contains("DIGEST-MD5"))) { mechs.remove("ANONYMOUS"); } SVNAuthenticator authenticator = createSASLAuthenticator(); authenticator.authenticate(mechs, myRealm, repository); receiveRepositoryCredentials(repository); }
public void authenticate(SVNRepositoryImpl repository) throws SVNException { List items = read("ls", null, true); List mechs = SVNReader.getList(items, 0); if (mechs == null || mechs.size() == 0) { return; } myRealm = SVNReader.getString(items, 1); ISVNAuthenticationManager authManager = myRepository.getAuthenticationManager(); if (authManager != null && authManager.isAuthenticationForced() && mechs.contains("ANONYMOUS") && (mechs.contains("CRAM-MD5") || mechs.contains("DIGEST-MD5"))) { mechs.remove("ANONYMOUS"); } SVNAuthenticator authenticator = createSASLAuthenticator(); authenticator.authenticate(mechs, myRealm, repository); receiveRepositoryCredentials(repository); }
try { myConnection.write("(w())", new Object[] { "close-edit" }); myConnection.read("[()]", null, true); Object[] items = myConnection.read("(N(?S)(?S)", new Object[3], true); Object[] error = null; try { error = myConnection.read("(?S)", new Object[1], false); } catch (SVNException e2) { myConnection.read(")", null, true); long revision = SVNReader.getLong(items, 0); Date date = SVNReader.getDate(items, 1);
private void receiveRepositoryCredentials(SVNRepositoryImpl repository) throws SVNException { if (myIsCredentialsReceived) { return; } List creds = read("s?s?l", null, true); myIsCredentialsReceived = true; if (creds != null && creds.size() >= 2 && creds.get(0) != null && creds.get(1) != null) { SVNURL rootURL = creds.get(1) != null ? SVNURL.parseURIEncoded(SVNReader.getString(creds, 1)) : null; if (rootURL != null && rootURL.toString().length() > repository.getLocation().toString().length()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Impossibly long repository root from server"), SVNLogType.NETWORK); } if (repository != null && repository.getRepositoryRoot(false) == null) { repository.updateCredentials(SVNReader.getString(creds, 0), rootURL); } if (myRealm == null) { myRealm = SVNReader.getString(creds, 0); } if (myRoot == null) { myRoot = SVNReader.getString(creds, 1); } if (creds.size() > 2 && creds.get(2) instanceof List) { List capabilities = (List) creds.get(2); addCapabilities(capabilities); } } }
private void receiveRepositoryCredentials(SVNRepositoryImpl repository) throws SVNException { if (myIsCredentialsReceived) { return; } List creds = read("s?s?l", null, true); myIsCredentialsReceived = true; if (creds != null && creds.size() >= 2 && creds.get(0) != null && creds.get(1) != null) { SVNURL rootURL = creds.get(1) != null ? SVNURL.parseURIEncoded(SVNReader.getString(creds, 1)) : null; if (rootURL != null && rootURL.toString().length() > repository.getLocation().toString().length()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Impossibly long repository root from server"), SVNLogType.NETWORK); } if (repository != null && repository.getRepositoryRoot(false) == null) { repository.updateCredentials(SVNReader.getString(creds, 0), rootURL); } if (myRealm == null) { myRealm = SVNReader.getString(creds, 0); } if (myRoot == null) { myRoot = SVNReader.getString(creds, 1); } if (creds.size() > 2 && creds.get(2) instanceof List) { List capabilities = (List) creds.get(2); addCapabilities(capabilities); } } }
private void receiveRepositoryCredentials(SVNRepositoryImpl repository) throws SVNException { if (myIsCredentialsReceived) { return; } List creds = read("s?s?l", null, true); myIsCredentialsReceived = true; if (creds != null && creds.size() >= 2 && creds.get(0) != null && creds.get(1) != null) { SVNURL rootURL = creds.get(1) != null ? SVNURL.parseURIEncoded(SVNReader.getString(creds, 1)) : null; if (rootURL != null && rootURL.toString().length() > repository.getLocation().toString().length()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Impossibly long repository root from server"), SVNLogType.NETWORK); } if (repository != null && repository.getRepositoryRoot(false) == null) { repository.updateCredentials(SVNReader.getString(creds, 0), rootURL); } if (myRealm == null) { myRealm = SVNReader.getString(creds, 0); } if (myRoot == null) { myRoot = SVNReader.getString(creds, 1); } if (creds.size() > 2 && creds.get(2) instanceof List) { List capabilities = (List) creds.get(2); addCapabilities(capabilities); } } }
List items; try { items = read("ls", null, true);
protected void handshake(SVNRepositoryImpl repository) throws SVNException { Object[] items = read("[(*N(*W)(*W))]", null, true); if (!SVNReader.hasValue(items, 0, 2)) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_BAD_VERSION, "Only protocol of version '2' or older is supported")); } else if (!SVNReader.hasValue(items, 2, EDIT_PIPELINE)) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_BAD_VERSION, "Only servers with 'edit-pipeline' capability is supported")); } myIsSVNDiff1 = SVNReader.hasValue(items, 2, SVNDIFF1); write("(n(www)s)", new Object[] { "2", EDIT_PIPELINE, SVNDIFF1, ABSENT_ENTRIES, repository.getLocation().toString() }); }