private void handleUnsupportedCommand(SVNException e, String message) throws SVNException { if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_UNKNOWN_CMD) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_IMPLEMENTED, message); SVNErrorManager.error(err, e.getErrorMessage(), SVNLogType.NETWORK); } throw e; }
public boolean isEnoent() { SVNErrorCode errorCode = getErrorMessage().getErrorCode(); return errorCode == SVNErrorCode.ENTRY_NOT_FOUND || errorCode == SVNErrorCode.FS_NOT_FOUND || errorCode == SVNErrorCode.FS_NOT_OPEN || errorCode == SVNErrorCode.FS_NOT_FILE; } }
private void fixError(String path, SVNException e, SVNNodeKind kind) throws SVNException { SVNErrorMessage err = e.getErrorMessage(); if (err.getErrorCode() == SVNErrorCode.FS_NOT_FOUND || err.getErrorCode() == SVNErrorCode.RA_DAV_PATH_NOT_FOUND) { err = SVNErrorMessage.create(SVNErrorCode.WC_NOT_UP_TO_DATE, kind == SVNNodeKind.DIR ? "Directory ''{0}'' is out of date" : "File ''{0}'' is out of date", path); throw new SVNException(err); } throw e; }
private static int readFormatVersion(File adminDir) throws SVNException { SVNErrorMessage error = null; int version = -1; Collection enabledFactories = getSelector().getEnabledFactories(adminDir.getParentFile(), ourFactories, false); for(Iterator factories = enabledFactories.iterator(); factories.hasNext();) { SVNAdminAreaFactory factory = (SVNAdminAreaFactory) factories.next(); try { version = factory.getVersion(adminDir); } catch (SVNException e) { error = e.getErrorMessage(); continue; } return version; } if (error == null) { error = SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY, "''{0}'' is not a working copy", adminDir); } SVNErrorManager.error(error, SVNLogType.WC); return -1; }
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Long revision = (Long) pathsToRevisions.get(path); String reposPath = getRepositoryPath(path); long curRevision = (revision == null || isInvalidRevision(revision.longValue())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
@Override protected Void run(SVNWCContext context) throws SVNException { boolean timestampSleep = false; Collection<SvnCopySource> sources = getOperation().getSources(); try { timestampSleep = tryRun(context, sources, getFirstTarget()); return null; } catch (SVNException e) { SVNErrorCode code = e.getErrorMessage().getErrorCode(); if (!getOperation().isFailWhenDstExists() && getOperation().getSources().size() == 1 && (code == SVNErrorCode.ENTRY_EXISTS || code == SVNErrorCode.FS_ALREADY_EXISTS)) { SvnCopySource source = sources.iterator().next(); timestampSleep = tryRun(context, sources, new File(getFirstTarget(), source.getSource().getFile().getName())); return null; } throw e; } finally { if (timestampSleep) { sleepForTimestamp(); } } }
public static void translationError(File path, IOException e) throws SVNException { SVNErrorMessage error; if (path != null) { error = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Failed to translate ''{0}''", new Object[]{path}); } else { error = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Translation failed"); } Throwable cause = e; if (e instanceof IOExceptionWrapper) { IOExceptionWrapper wrapper = (IOExceptionWrapper) e; SVNException wrappedException = wrapper.getOriginalException(); if (wrappedException != null) { error.setChildErrorMessage(wrappedException.getErrorMessage()); cause = wrappedException; } } SVNErrorManager.error(error, cause, SVNLogType.DEFAULT); }
private void createDBLogsLock(File dstPath) throws SVNException { try { SVNFileUtil.createFile(new File(dstPath, FSFS.DB_LOGS_LOCK_FILE), FSFS.PRE_12_COMPAT_UNNEEDED_FILE_CONTENTS, "US-ASCII"); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage().wrap("Creating db logs lock file"); SVNErrorManager.error(err, SVNLogType.FSFS); } }
public static FSNodeHistory getNodeHistory(FSRevisionRoot root, String path) throws SVNException { FSRevisionNode node = null; SVNNodeKind kind = null; try { node = root.openPath(path, true, false).getRevNode(); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.FS_NOT_FOUND) { kind = SVNNodeKind.NONE; } throw svne; } kind = node.getType(); if (kind == SVNNodeKind.NONE) { SVNErrorManager.error(FSErrors.errorNotFound(root, path)); } return new FSNodeHistory(new SVNLocationEntry(root.getRevision(), path), false, new SVNLocationEntry(FSRepository.SVN_INVALID_REVNUM, null)); }
private static int readFormatVersion(File adminDir) throws SVNException { SVNErrorMessage error = null; int version = -1; Collection enabledFactories = getSelector().getEnabledFactories(adminDir.getParentFile(), ourFactories, false); for(Iterator factories = enabledFactories.iterator(); factories.hasNext();) { SVNAdminAreaFactory factory = (SVNAdminAreaFactory) factories.next(); try { version = factory.getVersion(adminDir); } catch (SVNException e) { error = e.getErrorMessage(); continue; } return version; } if (error == null) { error = SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY, "''{0}'' is not a working copy", adminDir); } SVNErrorManager.error(error, SVNLogType.WC); return -1; }
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Long revision = (Long) pathsToRevisions.get(path); String reposPath = getRepositoryPath(path); long curRevision = (revision == null || isInvalidRevision(revision.longValue())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
@Override protected SVNCommitInfo run(SVNWCContext context) throws SVNException { SVNCommitInfo info = null; try { info = doRun(context, getOperation().getFirstTarget().getURL()); } catch (SVNException e) { SVNErrorCode code = e.getErrorMessage().getErrorCode(); if (!getOperation().isFailWhenDstExists() && getOperation().getSources().size() == 1 && (code == SVNErrorCode.ENTRY_EXISTS || code == SVNErrorCode.FS_ALREADY_EXISTS)) { SvnCopySource source = getOperation().getSources().iterator().next(); SVNURL target = getOperation().getFirstTarget().getURL(); target = target.appendPath(source.getSource().getFile().getName(), false); info = doRun(context, target); } else { throw e; } } if (info != null) { getOperation().receive(getOperation().getFirstTarget(), info); } return info; }
private void handleUnsupportedCommand(SVNException e, String message) throws SVNException { if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_UNKNOWN_CMD) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_IMPLEMENTED, message); SVNErrorManager.error(err, e.getErrorMessage(), e, SVNLogType.NETWORK); } throw e; }
public SVNLock getLockHelper(String repositoryPath, boolean haveWriteLock) throws SVNException { SVNLock lock = null; try { lock = getLock(repositoryPath, haveWriteLock); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.FS_NO_SUCH_LOCK || svne.getErrorMessage().getErrorCode() == SVNErrorCode.FS_LOCK_EXPIRED) { return null; } throw svne; } return lock; }
public static void translationError(File path, IOException e) throws SVNException { SVNErrorMessage error; if (path != null) { error = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Failed to translate ''{0}''", new Object[]{path}); } else { error = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Translation failed"); } Throwable cause = e; if (e instanceof IOExceptionWrapper) { IOExceptionWrapper wrapper = (IOExceptionWrapper) e; SVNException wrappedException = wrapper.getOriginalException(); if (wrappedException != null) { error.setChildErrorMessage(wrappedException.getErrorMessage()); cause = wrappedException; } } SVNErrorManager.error(error, cause, SVNLogType.DEFAULT); } }
private void fixError(String path, SVNException e, SVNNodeKind kind) throws SVNException { SVNErrorMessage err = e.getErrorMessage(); if (err.getErrorCode() == SVNErrorCode.FS_NOT_FOUND || err.getErrorCode() == SVNErrorCode.RA_DAV_PATH_NOT_FOUND) { err = SVNErrorMessage.create(SVNErrorCode.WC_NOT_UP_TO_DATE, kind == SVNNodeKind.DIR ? "Directory ''{0}'' is out of date" : "File ''{0}'' is out of date", path); throw new SVNException(err); } throw e; }
private void createDBLock(File dstPath) throws SVNException { try { SVNFileUtil.createFile(new File(dstPath, FSFS.DB_LOCK_FILE), FSFS.PRE_12_COMPAT_UNNEEDED_FILE_CONTENTS, "US-ASCII"); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage().wrap("Creating db lock file"); SVNErrorManager.error(err, SVNLogType.FSFS); } }
private static int readFormatVersion(File adminDir) throws SVNException { SVNErrorMessage error = null; int version = -1; Collection enabledFactories = getSelector().getEnabledFactories(adminDir.getParentFile(), ourFactories, false); for(Iterator factories = enabledFactories.iterator(); factories.hasNext();) { SVNAdminAreaFactory factory = (SVNAdminAreaFactory) factories.next(); try { version = factory.getVersion(adminDir); } catch (SVNException e) { error = e.getErrorMessage(); continue; } return version; } if (error == null) { error = SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY, "''{0}'' is not a working copy", adminDir); } SVNErrorManager.error(error, SVNLogType.WC); return -1; }
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Long revision = (Long) pathsToRevisions.get(path); String reposPath = getRepositoryPath(path); long curRevision = (revision == null || isInvalidRevision(revision.longValue())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
private void handleUnsupportedCommand(SVNException e, String message) throws SVNException { if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_UNKNOWN_CMD) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_IMPLEMENTED, message); SVNErrorManager.error(err, e.getErrorMessage()); } throw e; } }