Merge "Fix ResultSet#toBoolean() not working properly for all dialects" into stable-2.14
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_139.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_139.java
index be919a1..4dfc41a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_139.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_139.java
@@ -15,6 +15,8 @@
 package com.google.gerrit.server.schema;
 
 import com.google.auto.value.AutoValue;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
 import com.google.common.collect.ListMultimap;
 import com.google.common.collect.MultimapBuilder;
 import com.google.gerrit.common.Nullable;
@@ -92,11 +94,11 @@
             ProjectWatch.builder()
                 .project(new Project.NameKey(rs.getString(2)))
                 .filter(rs.getString(3))
-                .notifyAbandonedChanges(rs.getBoolean(4))
-                .notifyAllComments(rs.getBoolean(5))
-                .notifyNewChanges(rs.getBoolean(6))
-                .notifyNewPatchSets(rs.getBoolean(7))
-                .notifySubmittedChanges(rs.getBoolean(8));
+                .notifyAbandonedChanges(toBoolean(rs.getString(4)))
+                .notifyAllComments(toBoolean(rs.getString(5)))
+                .notifyNewChanges(toBoolean(rs.getString(6)))
+                .notifyNewPatchSets(toBoolean(rs.getString(7)))
+                .notifySubmittedChanges(toBoolean(rs.getString(8)));
         imports.put(accountId, b.build());
       }
     }
@@ -196,4 +198,9 @@
       abstract ProjectWatch build();
     }
   }
+
+  private static boolean toBoolean(String v) {
+    Preconditions.checkState(!Strings.isNullOrEmpty(v));
+    return v.equals("Y");
+  }
 }