Merge branch 'stable-2.14'

* stable-2.14:
  Fix ResultSet#toBoolean() not working properly for all dialects

Change-Id: Ie9eb612c9fc448caa973d6959f780b7f96ec327e
This commit is contained in:
David Pursehouse
2017-09-12 15:24:04 +09:00

View File

@@ -15,6 +15,8 @@
package com.google.gerrit.server.schema; package com.google.gerrit.server.schema;
import com.google.auto.value.AutoValue; 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.ListMultimap;
import com.google.common.collect.MultimapBuilder; import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.common.Nullable; import com.google.gerrit.common.Nullable;
@@ -92,11 +94,11 @@ public class Schema_139 extends SchemaVersion {
ProjectWatch.builder() ProjectWatch.builder()
.project(new Project.NameKey(rs.getString(2))) .project(new Project.NameKey(rs.getString(2)))
.filter(rs.getString(3)) .filter(rs.getString(3))
.notifyAbandonedChanges(rs.getBoolean(4)) .notifyAbandonedChanges(toBoolean(rs.getString(4)))
.notifyAllComments(rs.getBoolean(5)) .notifyAllComments(toBoolean(rs.getString(5)))
.notifyNewChanges(rs.getBoolean(6)) .notifyNewChanges(toBoolean(rs.getString(6)))
.notifyNewPatchSets(rs.getBoolean(7)) .notifyNewPatchSets(toBoolean(rs.getString(7)))
.notifySubmittedChanges(rs.getBoolean(8)); .notifySubmittedChanges(toBoolean(rs.getString(8)));
imports.put(accountId, b.build()); imports.put(accountId, b.build());
} }
} }
@@ -196,4 +198,9 @@ public class Schema_139 extends SchemaVersion {
abstract ProjectWatch build(); abstract ProjectWatch build();
} }
} }
private static boolean toBoolean(String v) {
Preconditions.checkState(!Strings.isNullOrEmpty(v));
return v.equals("Y");
}
} }