本文整理汇总了Java中org.tmatesoft.svn.core.SVNErrorMessage类的典型用法代码示例。如果您正苦于以下问题:Java SVNErrorMessage类的具体用法?Java SVNErrorMessage怎么用?Java SVNErrorMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SVNErrorMessage类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNErrorMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCopy
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public long getCopy(String relativePath, long revision, SVNProperties properties, OutputStream contents) throws SVNException {
// URL 검증
if (relativePath.isEmpty() || relativePath.endsWith("/"))
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.BAD_URL, "Invalide relativePath : " + relativePath));
SVNRepository repository = getRepository();
LOGGER.debug("getCopy : {} ", relativePath);
SVNNodeKind checkPath = repository.checkPath(relativePath, revision);
long result = -1;
if (checkPath == SVNNodeKind.FILE) {
// return the revision the file has been taken at
result = repository.getFile(relativePath, revision, properties, contents);
int lastIndexOf = ValueUtil.lastIndexOf(relativePath, '/');
String fileName = relativePath.substring(lastIndexOf) + 1;
LOGGER.debug(fileName);
}
return result;
}
示例2: checkForException
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
private void checkForException(final StringBuffer sbError) throws SVNException {
if (sbError.length() == 0) return;
final String message = sbError.toString();
final Matcher matcher = ourExceptionPattern.matcher(message);
if (matcher.matches()) {
final String group = matcher.group(1);
if (group != null) {
try {
final int code = Integer.parseInt(group);
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.getErrorCode(code), message));
} catch (NumberFormatException e) {
//
}
}
}
if (message.contains(ourAuthenticationRealm)) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.AUTHN_CREDS_UNAVAILABLE, message));
}
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, message));
}
示例3: requestClientAuthentication
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public SVNAuthentication requestClientAuthentication(final String kind, final SVNURL url, final String realm, final SVNErrorMessage errorMessage,
final SVNAuthentication previousAuth, final boolean authMayBeStored) {
try {
return wrapNativeCall(new ThrowableComputable<SVNAuthentication, SVNException>() {
@Override
public SVNAuthentication compute() throws SVNException {
final SVNAuthentication svnAuthentication =
myDelegate.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
myListener.getMulticaster().requested(ProviderType.persistent, url, realm, kind, svnAuthentication == null);
return svnAuthentication;
}
});
}
catch (SVNException e) {
LOG.info(e);
throw new RuntimeException(e);
}
}
示例4: requestClientAuthentication
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public SVNAuthentication requestClientAuthentication(final String kind,
final SVNURL url,
final String realm,
SVNErrorMessage errorMessage,
final SVNAuthentication previousAuth,
final boolean authMayBeStored) {
if (ApplicationManager.getApplication().isUnitTestMode() && ISVNAuthenticationManager.USERNAME.equals(kind)) {
final String userName = previousAuth != null && previousAuth.getUserName() != null ? previousAuth.getUserName() : SystemProperties.getUserName();
return new SVNUserNameAuthentication(userName, false);
}
final SvnAuthenticationNotifier.AuthenticationRequest obj =
new SvnAuthenticationNotifier.AuthenticationRequest(myProject, kind, url, realm);
final SVNURL wcUrl = myAuthenticationNotifier.getWcUrl(obj);
if (wcUrl == null || ourForceInteractive.contains(Thread.currentThread())) {
// outside-project url
return mySvnInteractiveAuthenticationProvider.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
} else {
if (myAuthenticationNotifier.ensureNotify(obj)) {
return myAuthenticationManager.requestFromCache(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
}
}
return null;
}
示例5: getEnabledFactories
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public Collection getEnabledFactories(File path, Collection factories, boolean writeAccess) throws SVNException {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return factories;
}
if (!writeAccess) {
return factories;
}
Collection result = null;
final WorkingCopyFormat presetFormat = SvnWorkingCopyFormatHolder.getPresetFormat();
if (presetFormat != null) {
result = format2Factories(presetFormat, factories);
}
if (result == null) {
final WorkingCopyFormat format = SvnFormatSelector.getWorkingCopyFormat(path);
result = format2Factories(format, factories);
}
if (result == null) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY));
}
return result;
}
示例6: waitForFreeConnections
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
private void waitForFreeConnections() throws SVNException {
synchronized (myLock) {
while (myCurrentlyActiveConnections >= CachingSvnRepositoryPool.ourMaxTotal && ! myDisposed) {
try {
myLock.wait(500);
}
catch (InterruptedException e) {
//
}
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && indicator.isCanceled()) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.CANCELLED));
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ApplicationLevelNumberConnectionsGuardImpl.java
示例7: requestClientAuthentication
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
@Override
public SVNAuthentication requestClientAuthentication(String kind,
SVNURL url,
String realm,
SVNErrorMessage errorMessage,
SVNAuthentication previousAuth,
boolean authMayBeStored) {
authMayBeStored = authMayBeStored && mySaveData;
Convertor<SVNURL, SVNAuthentication> convertor = myData.get(kind);
SVNAuthentication result = convertor == null ? null : convertor.convert(url);
if (result == null) {
if (ISVNAuthenticationManager.USERNAME.equals(kind)) {
result = new SVNUserNameAuthentication("username", authMayBeStored);
} else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) {
result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSH.equals(kind)) {
result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSL.equals(kind)) {
result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false);
}
}
if (! ISVNAuthenticationManager.USERNAME.equals(kind)) {
myManager.requested(ProviderType.interactive, url, realm, kind, result == null);
}
return result;
}
示例8: requestClientAuthentication
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
@Override
public SVNAuthentication requestClientAuthentication(String kind,
SVNURL url,
String realm,
SVNErrorMessage errorMessage,
SVNAuthentication previousAuth,
boolean authMayBeStored) {
authMayBeStored = authMayBeStored && mySaveData;
SVNAuthentication result = null;
if (ISVNAuthenticationManager.USERNAME.equals(kind)) {
result = new SVNUserNameAuthentication("username", authMayBeStored);
} else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) {
result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSH.equals(kind)) {
result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSL.equals(kind)) {
result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false);
}
if (! ISVNAuthenticationManager.USERNAME.equals(kind)) {
myManager.requested(ProviderType.interactive, url, realm, kind, result == null);
}
return result;
}
示例9: handleAttributes
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
protected void handleAttributes(DAVElement parent, DAVElement element, Attributes attrs) throws SVNException {
if (element == ENTRY && parent == ServletDAVHandler.UPDATE_REPORT) {
setEntryLinkPath(attrs.getValue(LINKPATH_ATTR));
setEntryLockToken(attrs.getValue(LOCK_TOKEN_ATTR));
String revisionString = attrs.getValue(REVISION_ATTR);
if (revisionString == null) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Missing XML attribute: rev"), SVNLogType.NETWORK);
}
try {
setEntryRevision(Long.parseLong(revisionString));
} catch (NumberFormatException nfe) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, nfe), SVNLogType.NETWORK);
}
setDepth(SVNDepth.fromString(attrs.getValue(DEPTH_ATTR)));
if (attrs.getValue(START_EMPTY_ATTR) != null) {
setEntryStartEmpty(true);
}
} else if (element != MISSING || parent != ServletDAVHandler.UPDATE_REPORT) {
if (isInitialized()) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Invalid XML elements order: entry elements should follow any other."), SVNLogType.NETWORK);
}
getDAVRequest().startElement(parent, element, attrs);
}
}
示例10: getFileSHA1Checksum
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
@Override
public String getFileSHA1Checksum() throws SVNException {
String path = getCreatedPath();
long revision = getTextRepresentation().getRevision();
Repository gitRepository = myGitFS.getGitRepository();
try {
RevTree tree = new RevWalk(gitRepository).parseTree(gitRepository.resolve("refs/svn/" + revision));
TreeWalk treeWalk = TreeWalk.forPath(gitRepository, path, tree);
if (treeWalk.isSubtree()) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Attempted to get checksum of a *non*-file node");
SVNErrorManager.error(err, SVNLogType.FSFS);
}
return treeWalk.getObjectId(0).getName();
} catch (IOException e) {
SVNDebugLog.getDefaultLog().logError(SVNLogType.DEFAULT, e.getMessage());
return "";
}
}
示例11: getResourcePathInfo
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
private String getResourcePathInfo(HttpServletRequest request) throws SVNException {
String pathInfo = request.getPathInfo();
if (pathInfo == null || "".equals(pathInfo)) {
pathInfo = "/";
} else {
pathInfo = SVNEncodingUtil.uriDecode(pathInfo);
}
if (getDAVConfig().isUsingRepositoryPathDirective()) {
return pathInfo;
}
if (pathInfo == null || pathInfo.length() == 0 || "/".equals(pathInfo)) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED), SVNLogType.NETWORK);
//TODO: client tried to access repository parent path, result status code should be FORBIDDEN.
}
return DAVPathUtil.removeHead(pathInfo, true);
}
示例12: downloadFile
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public long downloadFile(String svn_path, String local_path) throws SVNException, IOException {
SVNNodeKind nodeKind = repository.checkPath(svn_path, version);
if ( nodeKind == SVNNodeKind.FILE ) {
SVNProperties props = new SVNProperties();
FileOutputStream fOS = new FileOutputStream(new File(local_path));
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
long updated = repository.getFile(svn_path, version, props, fOS);
buffer.flush();
buffer.close();
try {
updated = Long.parseLong(props.getStringValue(COMMIT_VERSION));
} catch (NumberFormatException e) {
logger.warn("Could not transform committed revision " + props.getStringValue("svn:entry:committed-rev") + " to a long value");
}
return updated;
} else {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.BAD_FILENAME, "requested file " + svn_path + " is not a file"));
}
}
示例13: getFile
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
/**
* Gets a file from the repository.
*
* @param sourceURL The full path to the file, reachable via the read repository.
* @param destination The destination file.
* @param revision The subversion revision.
* @throws SVNException If an error occurs retrieving the file from Subversion.
* @throws IOException If an error occurs writing the file contents to disk.
*/
public void getFile(SVNURL sourceURL, File destination, long revision) throws SVNException, IOException {
readRepository.setLocation(sourceURL, false);
SVNNodeKind nodeKind = readRepository.checkPath("", revision);
SVNErrorMessage error = SvnUtils.checkNodeIsFile(nodeKind, sourceURL);
if (error != null) {
Message.error("Error retrieving" + sourceURL + " [revision=" + revision + "]");
throw new IOException(error.getMessage());
}
BufferedOutputStream output = null;
try {
output = new BufferedOutputStream(new FileOutputStream(destination));
readRepository.getFile("", revision, null, output);
} finally {
if (output != null) {
output.close();
}
}
}
示例14: printStats
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
private void printStats(String path) {
try {
SVNURL url = SVNURL.parseURIEncoded(urlBase + path);
synccount = syncsize = 0;
logClient.doList(url, SVNRevision.HEAD, SVNRevision.HEAD, false, true,
this);
LOG.info(String.format("%s/%d items (%d bytes)... ", path, synccount,
syncsize));
} catch (SVNException e) {
SVNErrorMessage em = e.getErrorMessage();
if (em.getErrorCode().getCode() == 160013)
LOG.warning(String.format("%s not found\n", path));
else
LOG.warning(String.format("doList: %s\n", e.getMessage()));
}
}
示例15: testRenameLocked
import org.tmatesoft.svn.core.SVNErrorMessage; //导入依赖的package包/类
public void testRenameLocked() throws Exception {
String originalName = "TheOriginalPage";
String newName = "TheRenamedPage";
final PageReference originalPage = new PageReferenceImpl(originalName);
final PageReference newPage = new PageReferenceImpl(newName);
_operations.moveFile(null, originalName, 1, newName);
expectLastCall().andThrow(new SVNException(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED)));
replay();
SVNRenameAction action = new SVNPageStore.SVNRenameAction("", newPage, false, originalPage, 1);
try {
action.driveCommitEditor(null, _operations);
fail("Expected RenameException");
}
catch (RenameException ex) {
// OK
}
verify();
}