Merge branch 'stable-2.14'

* stable-2.14:
  Format BUILD file with buildifier
  Fix broken build

Change-Id: I05f399a91dadb2c4d6f764800b579b99e55c6098
diff --git a/BUILD b/BUILD
index 30ff94c..6adb380 100644
--- a/BUILD
+++ b/BUILD
@@ -3,11 +3,11 @@
 gerrit_plugin(
     name = "imagare",
     srcs = glob(["src/main/java/**/*.java"]),
-    resources = glob(["src/main/**/*"]),
     gwt_module = "com.googlesource.gerrit.plugins.imagare.Imagare",
     manifest_entries = [
         "Gerrit-PluginName: imagare",
         "Gerrit-Module: com.googlesource.gerrit.plugins.imagare.Module",
         "Gerrit-HttpModule: com.googlesource.gerrit.plugins.imagare.HttpModule",
-    ]
+    ],
+    resources = glob(["src/main/**/*"]),
 )
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 27ac2ae..35b668b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
@@ -151,7 +151,7 @@
   private String storeImage(ProjectControl pc, byte[] content, String fileName)
       throws AuthException, IOException, ResourceConflictException, PermissionBackendException,
           NoSuchProjectException {
-    long maxSize = getEffectiveMaxObjectSizeLimit(pc.getProjectState());
+    long maxSize = pc.getProjectState().getEffectiveMaxObjectSizeLimit().value;
     // maxSize == 0 means that there is no limit
     if (maxSize > 0 && content.length > maxSize) {
       throw new ResourceConflictException("image too large");
@@ -247,16 +247,6 @@
     return url.toString();
   }
 
-  private long getEffectiveMaxObjectSizeLimit(ProjectState p) {
-    long global = cfg.getLong("receive", "maxObjectSizeLimit", 0);
-    long local = p.getMaxObjectSizeLimit();
-    if (global > 0 && local > 0) {
-      return Math.min(global, local);
-    }
-    // zero means "no limit", in this case the max is more limiting
-    return Math.max(global, local);
-  }
-
   public static class ImageInfo {
     public String url;