Upgrade bazlets to latest master to build with 3.0.0-rc0 API

Change-Id: I2b9b318cc18f37a2822054a6b678dc237a1e12f7
diff --git a/WORKSPACE b/WORKSPACE
index 0698e83..7da83d5 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,24 +3,24 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "f3b3eecf061193e8909298bc9c35027df3bf9d44",
+    commit = "316b66f48048c1ee05d8525568f2533cff5ea252",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
 # Release Plugin API
-#load(
-#    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
-#    "gerrit_api",
-#)
-
-# Snapshot Plugin API
 load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-    "gerrit_api_maven_local",
+    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
+    "gerrit_api",
 )
 
+# Snapshot Plugin API
+#load(
+#    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
+#    "gerrit_api_maven_local",
+#)
+
 # Load release Plugin API
-#gerrit_api()
+gerrit_api()
 
 # Load snapshot Plugin API
-gerrit_api_maven_local()
+#gerrit_api_maven_local()
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
index 03b249f..b55cd05 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
@@ -15,6 +15,7 @@
 package com.googlesource.gerrit.plugins.task;
 
 import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.exceptions.StorageException;
 import com.google.gerrit.extensions.common.PluginDefinedInfo;
 import com.google.gerrit.index.query.Predicate;
 import com.google.gerrit.index.query.QueryParseException;
@@ -22,7 +23,6 @@
 import com.google.gerrit.server.change.ChangeAttributeFactory;
 import com.google.gerrit.server.query.change.ChangeData;
 import com.google.gerrit.server.query.change.ChangeQueryBuilder;
-import com.google.gwtorm.server.OrmException;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.task.TaskConfig.Task;
 import com.googlesource.gerrit.plugins.task.TaskTree.Node;
@@ -86,14 +86,14 @@
       }
       try {
         return createWithExceptions(c);
-      } catch (OrmException e) {
+      } catch (StorageException e) {
         log.atSevere().withCause(e).log("Cannot load tasks for: %s", c);
       }
     }
     return null;
   }
 
-  protected PluginDefinedInfo createWithExceptions(ChangeData c) throws OrmException {
+  protected PluginDefinedInfo createWithExceptions(ChangeData c) {
     TaskPluginAttribute a = new TaskPluginAttribute();
     try {
       for (Node node : definitions.getRootNodes()) {
@@ -109,8 +109,7 @@
     return a;
   }
 
-  protected void addApplicableTasks(List<TaskAttribute> tasks, ChangeData c, Node node)
-      throws OrmException {
+  protected void addApplicableTasks(List<TaskAttribute> tasks, ChangeData c, Node node) {
     try {
       Task def = node.definition;
       boolean applicable = match(c, def.applicable);
@@ -149,7 +148,7 @@
     }
   }
 
-  protected List<TaskAttribute> getSubTasks(ChangeData c, Node node) throws OrmException {
+  protected List<TaskAttribute> getSubTasks(ChangeData c, Node node) {
     List<TaskAttribute> subTasks = new ArrayList<>();
     for (Node subNode : node.getSubNodes()) {
       if (subNode == null) {
@@ -184,12 +183,12 @@
       match(c, task.fail);
       match(c, task.pass);
       return true;
-    } catch (OrmException | QueryParseException e) {
+    } catch (StorageException | QueryParseException e) {
       return false;
     }
   }
 
-  protected Status getStatus(ChangeData c, Task task, TaskAttribute a) throws OrmException {
+  protected Status getStatus(ChangeData c, Task task, TaskAttribute a) {
     try {
       return getStatusWithExceptions(c, task, a);
     } catch (QueryParseException e) {
@@ -198,7 +197,7 @@
   }
 
   protected Status getStatusWithExceptions(ChangeData c, Task task, TaskAttribute a)
-      throws OrmException, QueryParseException {
+      throws QueryParseException {
     if (isAllNull(task.pass, task.fail, a.subTasks)) {
       // A leaf task has no defined subtasks.
       boolean hasDefinedSubtasks =
@@ -281,7 +280,7 @@
     return true;
   }
 
-  protected boolean match(ChangeData c, String query) throws OrmException, QueryParseException {
+  protected boolean match(ChangeData c, String query) throws QueryParseException {
     if (query == null || query.equalsIgnoreCase("true")) {
       return true;
     }
@@ -300,7 +299,7 @@
           return true;
         }
         return cqb.parse(query).asMatchable().match(c);
-      } catch (OrmException | QueryParseException e) {
+      } catch (StorageException | QueryParseException e) {
       }
     }
     return null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
index f9027f9..8485f6c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
@@ -22,7 +22,6 @@
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.account.AccountResolver;
 import com.google.gerrit.server.config.AllUsersNameProvider;
-import com.google.gwtorm.server.OrmException;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.task.TaskConfig.External;
 import com.googlesource.gerrit.plugins.task.TaskConfig.Task;
@@ -100,7 +99,7 @@
       this.path.add(definition);
     }
 
-    public List<Node> getSubNodes() throws OrmException {
+    public List<Node> getSubNodes() {
       if (nodes == null) {
         nodes = new ArrayList<>();
         addSubDefinitions();
@@ -108,7 +107,7 @@
       return nodes;
     }
 
-    protected void addSubDefinitions() throws OrmException {
+    protected void addSubDefinitions() {
       addSubDefinitions(getSubTasks());
       addSubFileDefinitions();
       addExternalDefinitions();
@@ -124,7 +123,7 @@
       }
     }
 
-    protected void addExternalDefinitions() throws OrmException {
+    protected void addExternalDefinitions() {
       for (String external : definition.subTasksExternals) {
         try {
           External ext = definition.config.getExternal(external);
@@ -147,8 +146,7 @@
       return tasks;
     }
 
-    protected List<Task> getTasks(External external)
-        throws ConfigInvalidException, IOException, OrmException {
+    protected List<Task> getTasks(External external) throws ConfigInvalidException, IOException {
       return getTasks(resolveUserBranch(external.user), external.file);
     }
 
@@ -171,7 +169,7 @@
     }
 
     protected Branch.NameKey resolveUserBranch(String user)
-        throws ConfigInvalidException, IOException, OrmException {
+        throws ConfigInvalidException, IOException {
       if (user == null) {
         throw new ConfigInvalidException("External user not defined");
       }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/cli/PatchSetArgument.java b/src/main/java/com/googlesource/gerrit/plugins/task/cli/PatchSetArgument.java
index 2bb051e..9fbddeb 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/cli/PatchSetArgument.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/cli/PatchSetArgument.java
@@ -13,6 +13,7 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.task.cli;
 
+import com.google.gerrit.exceptions.StorageException;
 import com.google.gerrit.extensions.restapi.AuthException;
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.PatchSet;
@@ -23,7 +24,6 @@
 import com.google.gerrit.server.permissions.PermissionBackend;
 import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.google.gerrit.sshd.BaseCommand.UnloggedFailure;
-import com.google.gwtorm.server.OrmException;
 import com.google.inject.Inject;
 
 public class PatchSetArgument {
@@ -49,17 +49,13 @@
       try {
         PatchSet.Id patchSetId = parsePatchSet(token);
         ChangeNotes changeNotes = notesFactory.createChecked(patchSetId.getParentKey());
-        permissionBackend
-            .user(user)
-            .change(changeNotes)
-            .check(ChangePermission.READ);
-        return new PatchSetArgument(
-            changeNotes.getChange(), psUtil.get(changeNotes, patchSetId));
+        permissionBackend.user(user).change(changeNotes).check(ChangePermission.READ);
+        return new PatchSetArgument(changeNotes.getChange(), psUtil.get(changeNotes, patchSetId));
       } catch (PermissionBackendException | AuthException e) {
         throw new IllegalArgumentException("database error", e);
       } catch (UnloggedFailure e) {
         throw new IllegalArgumentException(e.getMessage(), e);
-      } catch (OrmException e) {
+      } catch (StorageException e) {
         throw new IllegalArgumentException("database error", e);
       }
     }