Merge branch 'stable-2.11' * stable-2.11: Use auto-closeable RevWalk Remove unused imports Avoid NPE when getting groups for anonymous users Identify the OAuth provider as simply "GitHub" Implementation of Gerrit OAuthServiceProvider Change-Id: Ie6171cbc237205ba390cae82d15c862fb2d53196
diff --git a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java index 8cf64ab..70eb514 100644 --- a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java +++ b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java
@@ -37,22 +37,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.HttpClient; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Charsets; -import com.google.common.base.Strings; -import com.google.common.io.CharStreams; -import com.google.gson.Gson; -import com.google.inject.Inject; -import com.google.inject.Singleton; import com.google.gerrit.extensions.auth.oauth.OAuthToken; import com.google.gerrit.extensions.auth.oauth.OAuthVerifier;
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GitHubOAuthServiceProvider.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GitHubOAuthServiceProvider.java index 575ea11..0a617fc 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GitHubOAuthServiceProvider.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GitHubOAuthServiceProvider.java
@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.Sets; -import com.google.gerrit.extensions.annotations.PluginName; import com.google.gerrit.extensions.auth.oauth.OAuthServiceProvider; import com.google.gerrit.extensions.auth.oauth.OAuthToken; import com.google.gerrit.extensions.auth.oauth.OAuthUserInfo;
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GuiceHttpModule.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GuiceHttpModule.java index 625f664..97bc6be 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GuiceHttpModule.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GuiceHttpModule.java
@@ -38,9 +38,6 @@ import com.googlesource.gerrit.plugins.github.velocity.VelocityViewServlet; import com.googlesource.gerrit.plugins.github.wizard.VelocityControllerServlet; -import org.apache.http.client.HttpClient; -import org.apache.velocity.runtime.RuntimeInstance; - public class GuiceHttpModule extends ServletModule { @Override
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java index 169f92a..d6a7213 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java
@@ -114,8 +114,7 @@ projectControlFactory.controlFor(project.getNameKey()).controlForRef( destinationBranch); - try { - RevWalk revWalk = new RevWalk(git); + try (RevWalk revWalk = new RevWalk(git)) { try { Ref destRef = git.getRef(destinationBranch); if (destRef == null) { @@ -181,7 +180,6 @@ doValidation)); } } finally { - revWalk.close(); if (newChange == null) { db.rollback(); }
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java index 2d34231..8449edb 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java
@@ -210,10 +210,10 @@ .listCommits()) { ObjectId pullRequestHeadObjectId = ObjectId.fromString(pullRequestCommit.getSha()); - + try { gitWalk.parseCommit(pullRequestHeadObjectId); - + ResultSet<PatchSet> patchSets; try { patchSets =