Merge branch 'stable-2.14'
* stable-2.14:
DeleteImage: Add missing cases in switch on RefUpdate.Result
PostImage: Remove unused Config
ImageServlet: Suppress warning about deprecated Hashing.md5()
Fix unnecessarily nested else-clauses
Format Java files with google-java-format
Change-Id: I0f4b84f78a41a169c64634d1d5cd5a927235e2fe
diff --git a/src/main/java/com/googlesource/gerrit/plugins/imagare/DeleteImage.java b/src/main/java/com/googlesource/gerrit/plugins/imagare/DeleteImage.java
index 6ea433c..9f71e9d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/imagare/DeleteImage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/DeleteImage.java
@@ -113,6 +113,8 @@
case NOT_ATTEMPTED:
case REJECTED:
case RENAMED:
+ case REJECTED_MISSING_OBJECT:
+ case REJECTED_OTHER_REASON:
default:
log.error("Cannot delete " + rsrc.getRef() + ": " + result.name());
throw new ResourceConflictException("cannot delete branch: " + result.name());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/imagare/ImageServlet.java b/src/main/java/com/googlesource/gerrit/plugins/imagare/ImageServlet.java
index 2d5ecc8..6c52b46 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/imagare/ImageServlet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/ImageServlet.java
@@ -222,6 +222,7 @@
return path;
}
+ @SuppressWarnings("deprecation")
private static String computeETag(Project.NameKey project, ObjectId revId, String file) {
return Hashing.md5()
.newHasher()
diff --git a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
index 35b668b..f1b54d3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
@@ -28,7 +28,6 @@
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.config.CanonicalWebUrl;
-import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.mime.FileTypeRegistry;
@@ -37,7 +36,6 @@
import com.google.gerrit.server.project.NoSuchProjectException;
import com.google.gerrit.server.project.ProjectControl;
import com.google.gerrit.server.project.ProjectResource;
-import com.google.gerrit.server.project.ProjectState;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.googlesource.gerrit.plugins.imagare.PostImage.Input;
@@ -47,7 +45,6 @@
import java.util.regex.Pattern;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.jgit.lib.CommitBuilder;
-import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
@@ -73,7 +70,6 @@
private final GitReferenceUpdated referenceUpdated;
private final PersonIdent myIdent;
private final String canonicalWebUrl;
- private final Config cfg;
private final String pluginName;
private final CreateRefControl createRefControl;
@@ -85,7 +81,6 @@
GitReferenceUpdated referenceUpdated,
@GerritPersonIdent PersonIdent myIdent,
@CanonicalWebUrl String canonicalWebUrl,
- @GerritServerConfig Config cfg,
@PluginName String pluginName,
CreateRefControl createRefControl) {
this.registry = registry;
@@ -95,7 +90,6 @@
this.referenceUpdated = referenceUpdated;
this.myIdent = myIdent;
this.canonicalWebUrl = canonicalWebUrl;
- this.cfg = cfg;
this.pluginName = pluginName;
this.createRefControl = createRefControl;
}