Merge branch 'stable-3.1'
* stable-3.1:
Bump Bazel version to 3.0.0
Upgrade bazlets to latest stable-2.16 to build with 2.16.17 API
Upgrade bazlets to latest stable-2.16
Change-Id: If6898ee2569cba6a489fc6fb2d30d2b426c85368
diff --git a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java
index 05842c4..417c968 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java
@@ -39,7 +39,7 @@
import com.google.gerrit.server.query.change.InternalChangeQuery;
import com.google.gerrit.server.restapi.project.ListChildProjects;
import com.google.gerrit.server.submit.MergeOpRepoManager;
-import com.google.gerrit.server.submit.SubmoduleException;
+import com.google.gerrit.server.submit.SubmoduleConflictException;
import com.google.gerrit.server.submit.SubmoduleOp;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -165,7 +165,7 @@
} catch (RepositoryNotFoundException e) {
// we're trying to delete the repository,
// so this exception should not stop us
- } catch (IOException | SubmoduleException e) {
+ } catch (IOException | SubmoduleConflictException e) {
throw new CannotDeleteProjectException("Project is subscribed by other projects.", e);
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/HideProject.java b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/HideProject.java
index c5bf8ce..7656726 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/HideProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/HideProject.java
@@ -84,7 +84,7 @@
}
private void createProjectIfMissing(String projectName) throws IOException, RestApiException {
- if (projectCache.get(Project.nameKey(projectName)) == null) {
+ if (!projectCache.get(Project.nameKey(projectName)).isPresent()) {
try {
createProject.apply(TopLevelResource.INSTANCE, IdString.fromDecoded(projectName), null);
} catch (RestApiException | ConfigInvalidException | PermissionBackendException e) {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/deleteproject/DeleteProjectIT.java b/src/test/java/com/googlesource/gerrit/plugins/deleteproject/DeleteProjectIT.java
index d83fac7..4960816 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/deleteproject/DeleteProjectIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/deleteproject/DeleteProjectIT.java
@@ -19,15 +19,16 @@
import static com.google.gerrit.acceptance.GitUtil.pushHead;
import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allow;
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
+import static com.google.gerrit.server.project.ProjectCache.illegalState;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import com.google.common.base.Joiner;
-import com.google.gerrit.acceptance.GerritConfig;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.acceptance.UseSsh;
+import com.google.gerrit.acceptance.config.GerritConfig;
import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations;
import com.google.gerrit.common.data.Permission;
@@ -173,7 +174,7 @@
String cmd = createDeleteCommand("--preserve-git-repository", project.get());
adminSshSession.exec(cmd);
- ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
+ ProjectConfig cfg = projectCache.get(project).orElseThrow(illegalState(project)).getConfig();
ProjectState state = cfg.getProject().getState();
assertThat(state).isEqualTo(ProjectState.HIDDEN);