Fix repositories listing by checking Gerrit repo with Optional Gerrit v3.2 returns an empty Optional<ProjectState> instead of null. Fix an issue where the GitHub projects listing was always returning the empty list because the result of projects.get() was always not null. Bug: Issue 12827 Change-Id: I41dba04e9bc3c2437ca72be135d4ec3612d8501a
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java index bd069a8..2cf6170 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java
@@ -67,7 +67,7 @@ if (ghRepository.hasPushAccess() && ghRepository.hasPullAccess()) { JsonObject repository = new JsonObject(); String projectName = organisation + "/" + ghRepository.getName(); - if (projects.get(Project.NameKey.parse(projectName)) == null) { + if (!projects.get(Project.NameKey.parse(projectName)).isPresent()) { repository.add("name", new JsonPrimitive(ghRepository.getName())); repository.add("organisation", new JsonPrimitive(organisation)); repository.add(