本文整理汇总了Java中org.tmatesoft.svn.core.SVNErrorCode类的典型用法代码示例。如果您正苦于以下问题:Java SVNErrorCode类的具体用法?Java SVNErrorCode怎么用?Java SVNErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SVNErrorCode类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNErrorCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCopy
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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: process
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Override
public boolean process(Exception e) {
if (e instanceof SVNException) {
final SVNErrorCode errorCode = ((SVNException)e).getErrorMessage().getErrorCode();
if (SVNErrorCode.WC_LOCKED.equals(errorCode)) {
return true;
}
else if (SVNErrorCode.SQLITE_ERROR.equals(errorCode)) {
Throwable cause = ((SVNException)e).getErrorMessage().getCause();
if (cause instanceof SqlJetException) {
return SqlJetErrorCode.BUSY.equals(((SqlJetException)cause).getErrorCode());
}
}
}
return false;
}
示例3: supportsMergeTracking
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
@Override
public boolean supportsMergeTracking(@NotNull SVNURL url) throws VcsException {
boolean result;
try {
myFactory.createHistoryClient()
.doLog(SvnTarget.fromURL(url), SVNRevision.HEAD, SVNRevision.create(1), false, false, true, 1, null, null);
result = true;
}
catch (SvnBindException e) {
if (e.contains(SVNErrorCode.UNSUPPORTED_FEATURE) && e.getMessage().contains("mergeinfo")) {
result = false;
}
else {
throw e;
}
}
return result;
}
示例4: checkForException
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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));
}
示例5: handleStatusException
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
private void handleStatusException(@NotNull MyItem item, @NotNull SvnBindException e) throws SvnBindException {
if (e.contains(SVNErrorCode.WC_NOT_DIRECTORY) || e.contains(SVNErrorCode.WC_NOT_FILE)) {
final VirtualFile virtualFile = item.getPath().getVirtualFile();
if (virtualFile != null && !isIgnoredByVcs(virtualFile)) {
// self is unversioned
myReceiver.processUnversioned(virtualFile);
if (virtualFile.isDirectory()) {
processRecursively(virtualFile, item.getDepth());
}
}
}
else {
throw e;
}
}
示例6: getEnabledFactories
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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;
}
示例7: waitForFreeConnections
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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
示例8: checkStatus
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
private static boolean checkStatus(SVNClientManager clientManager, InputFile inputFile) throws SVNException {
SVNStatusClient statusClient = clientManager.getStatusClient();
try {
SVNStatus status = statusClient.doStatus(inputFile.file(), false);
if (status == null) {
LOG.debug("File {} returns no svn state. Skipping it.", inputFile);
return false;
}
if (status.getContentsStatus() != SVNStatusType.STATUS_NORMAL) {
LOG.debug("File {} is not versionned or contains local modifications. Skipping it.", inputFile);
return false;
}
} catch (SVNException e) {
if (SVNErrorCode.WC_PATH_NOT_FOUND.equals(e.getErrorMessage().getErrorCode())
|| SVNErrorCode.WC_NOT_WORKING_COPY.equals(e.getErrorMessage().getErrorCode())) {
LOG.debug("File {} is not versionned. Skipping it.", inputFile);
return false;
}
throw e;
}
return true;
}
示例9: execute
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
public void execute() throws SVNException {
long read = readInput(false);
if (myIsUnknownReport) {
throw new DAVException("The requested report is unknown.", null, HttpServletResponse.SC_NOT_IMPLEMENTED, null, SVNLogType.DEFAULT, Level.FINE,
null, DAVXMLUtil.SVN_DAV_ERROR_TAG, DAVElement.SVN_DAV_ERROR_NAMESPACE, SVNErrorCode.UNSUPPORTED_FEATURE.getCode(), null);
}
if (read == 0) {
throw new DAVException("The request body must specify a report.", HttpServletResponse.SC_BAD_REQUEST, SVNLogType.NETWORK);
}
setDefaultResponseHeaders();
setResponseContentType(DEFAULT_XML_CONTENT_TYPE);
setResponseStatus(HttpServletResponse.SC_OK);
getReportHandler().execute();
}
示例10: handleAttributes
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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);
}
}
示例11: getFileSHA1Checksum
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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 "";
}
}
示例12: getResourcePathInfo
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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);
}
示例13: downloadFile
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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"));
}
}
示例14: testRenameLocked
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的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();
}
示例15: unlock
import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
public void unlock(final PageReference ref, final String lockToken) throws PageStoreAuthenticationException, PageStoreException {
execute(new SVNAction<Void>() {
public Void perform(final BasicSVNOperations operations, final SVNRepository repository) throws SVNException, PageStoreException {
try {
repository.unlock(singletonMap(ref.getPath(), lockToken), true, new SVNLockHandlerAdapter());
}
catch (SVNException ex) {
// FIXME: Presumably this code would be different for non-http repositories.
if (SVNErrorCode.RA_DAV_REQUEST_FAILED.equals(ex.getErrorMessage().getErrorCode())) {
// We get this when the page has already been unlocked.
return null;
}
throw ex;
}
return null;
}
});
}