mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-14 20:45:16 +00:00
Rename DisabledRepositoryException to MissingRepositoryException
This commit is contained in:
parent
5e08f6f5c6
commit
6ae6acd826
6 changed files with 18 additions and 18 deletions
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge
bridge
server
snapshot/base
|
@ -35,7 +35,7 @@ import uk.ac.ic.wlgitbridge.git.handler.hook.WriteLatexPutHook;
|
|||
import uk.ac.ic.wlgitbridge.server.FileHandler;
|
||||
import uk.ac.ic.wlgitbridge.server.PostbackContents;
|
||||
import uk.ac.ic.wlgitbridge.server.PostbackHandler;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.DisabledRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.MissingRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.ForbiddenException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.getforversion.SnapshotAttachment;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.push.PostbackManager;
|
||||
|
@ -384,7 +384,7 @@ public class Bridge {
|
|||
* @param hostname
|
||||
* @throws SnapshotPostException
|
||||
* @throws IOException
|
||||
* @throws DisabledRepositoryException
|
||||
* @throws MissingRepositoryException
|
||||
* @throws ForbiddenException
|
||||
*/
|
||||
public void push(
|
||||
|
@ -393,7 +393,7 @@ public class Bridge {
|
|||
RawDirectory directoryContents,
|
||||
RawDirectory oldDirectoryContents,
|
||||
String hostname
|
||||
) throws SnapshotPostException, IOException, DisabledRepositoryException, ForbiddenException {
|
||||
) throws SnapshotPostException, IOException, MissingRepositoryException, ForbiddenException {
|
||||
try (LockGuard __ = lock.lockGuard(projectName)) {
|
||||
pushCritical(
|
||||
oauth2,
|
||||
|
@ -462,7 +462,7 @@ public class Bridge {
|
|||
* @param directoryContents
|
||||
* @param oldDirectoryContents
|
||||
* @throws IOException
|
||||
* @throws DisabledRepositoryException
|
||||
* @throws MissingRepositoryException
|
||||
* @throws ForbiddenException
|
||||
* @throws SnapshotPostException
|
||||
*/
|
||||
|
@ -471,7 +471,7 @@ public class Bridge {
|
|||
String projectName,
|
||||
RawDirectory directoryContents,
|
||||
RawDirectory oldDirectoryContents
|
||||
) throws IOException, DisabledRepositoryException, ForbiddenException, SnapshotPostException {
|
||||
) throws IOException, MissingRepositoryException, ForbiddenException, SnapshotPostException {
|
||||
Log.info("[{}] Pushing", projectName);
|
||||
String postbackKey = postbackManager.makeKeyForProject(projectName);
|
||||
Log.info(
|
||||
|
|
|
@ -2,7 +2,7 @@ package uk.ac.ic.wlgitbridge.bridge.snapshot;
|
|||
|
||||
import com.google.api.client.auth.oauth2.Credential;
|
||||
import uk.ac.ic.wlgitbridge.data.CandidateSnapshot;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.DisabledRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.MissingRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.ForbiddenException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.exception.FailedConnectionException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.getdoc.GetDocResult;
|
||||
|
@ -34,13 +34,13 @@ public interface SnapshotApi {
|
|||
String postbackKey);
|
||||
|
||||
static <T> T getResult(CompletableFuture<T> result)
|
||||
throws DisabledRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
throws MissingRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
try {
|
||||
return result.join();
|
||||
} catch (CompletionException e) {
|
||||
try {
|
||||
throw e.getCause();
|
||||
} catch (DisabledRepositoryException
|
||||
} catch (MissingRepositoryException
|
||||
| FailedConnectionException
|
||||
| ForbiddenException
|
||||
| RuntimeException r) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.google.api.client.auth.oauth2.Credential;
|
|||
import uk.ac.ic.wlgitbridge.data.CandidateSnapshot;
|
||||
import uk.ac.ic.wlgitbridge.data.model.Snapshot;
|
||||
import uk.ac.ic.wlgitbridge.git.exception.GitUserException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.DisabledRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.MissingRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.ForbiddenException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.exception.FailedConnectionException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.getdoc.GetDocResult;
|
||||
|
@ -66,7 +66,7 @@ public class SnapshotApiFacade {
|
|||
Optional<Credential> oauth2,
|
||||
CandidateSnapshot candidateSnapshot,
|
||||
String postbackKey
|
||||
) throws DisabledRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
) throws MissingRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
return SnapshotApi.getResult(api.push(
|
||||
oauth2, candidateSnapshot, postbackKey));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.apache.commons.codec.binary.Base64;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import uk.ac.ic.wlgitbridge.application.config.Oauth2;
|
||||
import uk.ac.ic.wlgitbridge.bridge.snapshot.SnapshotApi;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.DisabledRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.MissingRepositoryException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.base.ForbiddenException;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.getdoc.GetDocRequest;
|
||||
import uk.ac.ic.wlgitbridge.util.Instance;
|
||||
|
@ -77,8 +77,8 @@ public class Oauth2Filter implements Filter {
|
|||
filterChain
|
||||
);
|
||||
return;
|
||||
} catch (DisabledRepositoryException e) {
|
||||
disabled(project, (HttpServletResponse) servletResponse);
|
||||
} catch (MissingRepositoryException e) {
|
||||
missing(project, (HttpServletResponse) servletResponse);
|
||||
}
|
||||
Log.info("[{}] Auth not needed", project);
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
|
@ -203,11 +203,11 @@ public class Oauth2Filter implements Filter {
|
|||
w.close();
|
||||
}
|
||||
|
||||
private void disabled(
|
||||
private void missing(
|
||||
String projectName,
|
||||
HttpServletResponse response
|
||||
) throws IOException {
|
||||
Log.info("[{}] Git access to project disabled.", projectName);
|
||||
Log.info("[{}] Project missing.", projectName);
|
||||
|
||||
response.setContentType("text/plain");
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import uk.ac.ic.wlgitbridge.git.exception.SnapshotAPIException;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class DisabledRepositoryException extends SnapshotAPIException {
|
||||
public class MissingRepositoryException extends SnapshotAPIException {
|
||||
|
||||
@Override
|
||||
public void fromJSON(JsonElement json) {}
|
|
@ -50,7 +50,7 @@ public abstract class Request<T extends Result> {
|
|||
return ret;
|
||||
}
|
||||
|
||||
private T getResult() throws DisabledRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
private T getResult() throws MissingRepositoryException, FailedConnectionException, ForbiddenException {
|
||||
try {
|
||||
HttpResponse response = future.get();
|
||||
Log.info(
|
||||
|
@ -75,7 +75,7 @@ public abstract class Request<T extends Result> {
|
|||
case HttpServletResponse.SC_FORBIDDEN:
|
||||
throw new ForbiddenException();
|
||||
case HttpServletResponse.SC_GONE:
|
||||
throw new DisabledRepositoryException();
|
||||
throw new MissingRepositoryException();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue