• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SVNErrorCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.tmatesoft.svn.core.SVNErrorCode的典型用法代码示例。如果您正苦于以下问题:Java SVNErrorCode类的具体用法?Java SVNErrorCode怎么用?Java SVNErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SVNErrorCode类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNErrorCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:SVNCheckout.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RepeatSvnActionThroughBusy.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CmdRepositoryFeaturesClient.java


示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CmdUpdateClient.java


示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnRecursiveStatusWalker.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SvnKitAdminAreaFactorySelector.java


示例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;
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:23,代码来源:SvnBlameCommand.java


示例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();
}
 
开发者ID:naver,项目名称:svngit,代码行数:18,代码来源:SVNGitDAVReportHandler.java


示例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);
    }
}
 
开发者ID:naver,项目名称:svngit,代码行数:25,代码来源:SVNGitDAVUpdateHandler.java


示例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 "";
    }
}
 
开发者ID:naver,项目名称:svngit,代码行数:19,代码来源:GitFSRevisionNode.java


示例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);
}
 
开发者ID:naver,项目名称:svngit,代码行数:19,代码来源:SVNGitRepositoryManager.java


示例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"));
    }

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:MySVNClient.java


示例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();
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:19,代码来源:TestSVNPageStore.java


示例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;
    }
  });
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:19,代码来源:RepositoryBasicSVNOperations.java


示例16: lock

import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
public void lock(final PageReference ref, final long revision) throws AlreadyLockedException, PageStoreAuthenticationException, PageStoreException {
  execute(new SVNAction<VersionedPageInfo>() {
    public VersionedPageInfo perform(final BasicSVNOperations operations, final SVNRepository repository) throws SVNException, PageStoreException {
      try {
        Map<String, Long> pathsToRevisions = singletonMap(ref.getPath(), revision);
        repository.lock(pathsToRevisions, "Locked by reviki.", false, new SVNLockHandlerAdapter());
      }
      catch (SVNException ex) {
        if (SVNErrorCode.FS_PATH_ALREADY_LOCKED.equals(ex.getErrorMessage().getErrorCode())) {
          // The caller will check getLockedBy().
          throw new AlreadyLockedException(ex);
        }
        throw ex;
      }
      return null;
    }
  });

}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:20,代码来源:RepositoryBasicSVNOperations.java


示例17: copyUnversionedMembersOfDirectory

import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
private void copyUnversionedMembersOfDirectory(final File src, final File dst) throws SVNException {
  if (src.isDirectory()) {
    final SVNException[] exc = new SVNException[1];
    FileUtil.processFilesRecursively(src, new Processor<File>() {
      @Override
      public boolean process(File file) {
        String relativePath = FileUtil.getRelativePath(src, file);
        File newFile = new File(dst, relativePath);
        if (!newFile.exists()) {
          try {
            copyFileOrDir(src, dst);
          }
          catch (IOException e) {
            exc[0] = new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR), e);
            return false;
          }
        }
        return true;
      }
    });
    if (exc[0] != null) {
      throw exc[0];
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SvnFileSystemListener.java


示例18: getCurrentMapping

import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
@Nullable
public static String getCurrentMapping(final Project project, final File file) {
  final SvnVcs vcs = SvnVcs.getInstance(project);
  final SVNStatusClient statusClient = vcs.createStatusClient();
  try {
    final SVNStatus status = statusClient.doStatus(file, false);
    return status == null ? null : status.getChangelistName();
  }
  catch (SVNException e) {
    final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode();
    if (SVNErrorCode.WC_NOT_DIRECTORY.equals(errorCode) || SVNErrorCode.WC_NOT_FILE.equals(errorCode)) {
      LOG.debug("Logging only, exception is valid (caught) here", e);
    } else {
      LOG.info("Logging only, exception is valid (caught) here", e);
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:SvnChangelistListener.java


示例19: handleWorkingCopyRoot

import org.tmatesoft.svn.core.SVNErrorCode; //导入依赖的package包/类
public void handleWorkingCopyRoot(File root, ProgressIndicator progress) {
  if (progress != null) {
    showProgressMessage(progress, root);
  }
  try {
    SVNUpdateClient client = myVcs.createUpdateClient();
    client.setEventHandler(myHandler);

    long rev = doUpdate(root, client);

    if (rev < 0 && !isMerge()) {
      throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, SvnBundle.message("exception.text.root.was.not.properly.updated", root)));
    }
  }
  catch (SVNException e) {
    LOG.info(e);
    myExceptions.add(new VcsException(e));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:AbstractUpdateIntegrateCrawler.java


示例20: 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 = getWorkingCopyFormat(path);
    result = format2Factories(format, factories);
  }

  if (result == null) {
    throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY));
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SvnFormatSelector.java



注:本文中的org.tmatesoft.svn.core.SVNErrorCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SubtitleLayout类代码示例发布时间:2022-05-22
下一篇:
Java BitwiseType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap