use of org.tmatesoft.svn.core.SVNErrorCode in project MassBank-web by MassBank.
the class SVNClientWrapper method handleError.
/*
* Error handling
*/
private int handleError(String methodName, SVNException e, int cnt) {
if (SVNServiceManager.isTerminated) {
return ERROR_NEXT_BREAK;
}
int ret = ERROR_NEXT_RETRY;
SVNErrorCode errCode = e.getErrorMessage().getErrorCode();
String errMessage = errCode.toString();
logger.warning("[SVNService] " + methodName + " --> " + errMessage);
int maxRetry = 5;
if (methodName.equals("add") || methodName.equals("delete")) {
maxRetry = 1;
}
// E155004, E155010
if (errCode == SVNErrorCode.WC_LOCKED || errCode == SVNErrorCode.WC_PATH_NOT_FOUND) {
logger.warning("[SVNService] WC:" + workCopyPath);
try {
Thread.sleep(2000);
} catch (java.lang.InterruptedException ex) {
}
if (cnt <= maxRetry) {
if (cnt == maxRetry) {
cleanup();
}
logger.info("[SVNService] retry " + String.valueOf(cnt));
ret = ERROR_NEXT_RETRY;
} else {
ret = ERROR_NEXT_BREAK;
}
} else if (cnt == 1) {
// E155000
if (errCode == SVNErrorCode.WC_OBSTRUCTED_UPDATE) {
cleanDirectory();
} else // E155015
if (errCode == SVNErrorCode.WC_FOUND_CONFLICT) {
revert();
} else // E155032
if (errCode == SVNErrorCode.WC_DB_ERROR) {
cleanDirectory();
} else // E170000
if (errCode == SVNErrorCode.RA_ILLEGAL_URL) {
logger.info("[SVNService] URL:" + this.repoURL);
mkdir();
} else // E170001, E175002, E200005
if (errCode == SVNErrorCode.RA_NOT_AUTHORIZED || errCode == SVNErrorCode.RA_DAV_REQUEST_FAILED || errCode == SVNErrorCode.UNVERSIONED_RESOURCE) {
ret = ERROR_NEXT_BREAK;
} else // E175005
if (errCode == SVNErrorCode.RA_DAV_ALREADY_EXISTS) {
revert();
} else // E200030
if (errCode == SVNErrorCode.SQLITE_ERROR) {
cleanup();
}
} else {
ret = ERROR_NEXT_THROW;
}
return ret;
}
use of org.tmatesoft.svn.core.SVNErrorCode in project MassBank-web by MassBank.
the class SVNClientWrapper method getStatus.
/*
* Collects status information on a single Working Copy item.
*/
public StatusHandler getStatus() throws SVNException {
SVNStatusClient client = this.manager.getStatusClient();
StatusHandler status = null;
boolean reportAll = false;
boolean checkouted = false;
int cnt = 0;
while (true) {
try {
StatusHandler sh = new StatusHandler(checkouted);
long revision = client.doStatus(this.workCopy, true, true, reportAll, false, true, sh);
return sh;
} catch (SVNException e1) {
SVNErrorCode errCode = e1.getErrorMessage().getErrorCode();
// E155007
if (errCode == SVNErrorCode.WC_NOT_DIRECTORY) {
try {
checkout();
reportAll = checkouted = true;
} catch (SVNException e2) {
throw e2;
}
} else {
int ret = handleError("delete", e1, ++cnt);
switch(ret) {
case ERROR_NEXT_THROW:
throw e1;
case ERROR_NEXT_BREAK:
return null;
case ERROR_NEXT_RETRY:
continue;
}
}
}
}
}
use of org.tmatesoft.svn.core.SVNErrorCode in project MassBank-web by MassBank.
the class SVNClientWrapper method delete.
/*
* Schedules a Working Copy item for deletion.
*/
public boolean delete(String filePath) throws SVNException {
SVNWCClient client = this.manager.getWCClient();
int cnt = 0;
while (true) {
try {
client.doDelete(new File(filePath), true, false);
return true;
} catch (SVNException e) {
SVNErrorCode errCode = e.getErrorMessage().getErrorCode();
// E195006
if (errCode == SVNErrorCode.CLIENT_MODIFIED) {
String errMessage = errCode.toString();
logger.warning("[SVNService] delete --> " + errMessage);
return false;
}
int ret = handleError("delete", e, ++cnt);
switch(ret) {
case ERROR_NEXT_THROW:
throw e;
case ERROR_NEXT_BREAK:
return true;
case ERROR_NEXT_RETRY:
continue;
}
}
}
}
Aggregations