} else if (connection == null) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Can not establish connection to ''{0}''", realm), SVNLogType.NETWORK);
}
try {
mySession = connection.openSession();
SVNAuthentication author = authManager.getFirstAuthentication(ISVNAuthenticationManager.USERNAME, realm, repository.getLocation());
if (author == null) {
SVNErrorManager.cancel("authentication cancelled", SVNLogType.NETWORK);
}
String userName = author.getUserName();
if (userName == null || "".equals(userName.trim())) {
userName = authentication.getUserName();
}
if (author.getUserName() == null || author.getUserName().equals(authentication.getUserName()) ||
"".equals(author.getUserName())) {
repository.setExternalUserName("");
} else {
repository.setExternalUserName(author.getUserName());
}
author = new SVNUserNameAuthentication(userName, author.isStorageAllowed());
authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.USERNAME, realm, null, author);
if ("".equals(repository.getExternalUserName())) {
mySession.execCommand(SVNSERVE_COMMAND);
} else {