Handle the BadRequestException from ListProjects

ListProjects throws a BadRequestException which is not specified
by the listRepositories(...)  method of GitilesAccess.
To remedy this the exception is caught and thrown wrapped inside
an IOException which is specified.

Change-Id: Icc4914f73b32e521c5cda7d48ce4a7e74e27555e
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/GerritGitilesAccess.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/GerritGitilesAccess.java
index 8266242..6efb8f1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/GerritGitilesAccess.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/GerritGitilesAccess.java
@@ -16,6 +16,7 @@
 
 import com.google.common.collect.Maps;
 import com.google.gerrit.extensions.common.ProjectInfo;
+import com.google.gerrit.extensions.restapi.BadRequestException;
 import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.IdentifiedUser;
@@ -103,7 +104,12 @@
     for (String branch : branches) {
       lp.addShowBranch(branch);
     }
-    Map<String, ProjectInfo> projects = lp.apply();
+    Map<String, ProjectInfo> projects;
+    try {
+      projects = lp.apply();
+    } catch (BadRequestException bex) {
+      throw new IOException(bex);
+    }
     Map<String, RepositoryDescription> result = Maps.newLinkedHashMap();
     for (Map.Entry<String, ProjectInfo> e : projects.entrySet()) {
       result.put(e.getKey(), toDescription(e.getKey(), e.getValue()));