Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  Set version to 2.14.12
  [project.config] Allow to add commentLink entries
  ElasticVersionTest: Align tested versions w/ ElasticContainer last ones
  Assume correct relative or absolute URL from Weblink provider
  AbstractSubmit: Remove redundant assertion about null IOException
  ListMailFilter: Fix operator precedence warning raised by ErrorProne
  ListProjects: Fix operator precedence warning raised by ErrorProne
  ChangeBundle: Fix operator precedence warning raised by ErrorProne
  Bazel: fix error_prone_warnings_toolchain rule

Change-Id: Ic572e4da073e40d756ef3a3f47df064cbea9d234
This commit is contained in:
David Pursehouse 2018-09-07 12:20:34 +09:00
commit 68c4189f41
6 changed files with 45 additions and 9 deletions

View File

@ -29,14 +29,13 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.forVersion("2.4.6")).isEqualTo(ElasticVersion.V2_4);
assertThat(ElasticVersion.forVersion("5.6.0")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("5.6.9")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("5.6.10")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("5.6.11")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("6.2.0")).isEqualTo(ElasticVersion.V6_2);
assertThat(ElasticVersion.forVersion("6.2.4")).isEqualTo(ElasticVersion.V6_2);
assertThat(ElasticVersion.forVersion("6.3.0")).isEqualTo(ElasticVersion.V6_3);
assertThat(ElasticVersion.forVersion("6.3.1")).isEqualTo(ElasticVersion.V6_3);
assertThat(ElasticVersion.forVersion("6.3.2")).isEqualTo(ElasticVersion.V6_3);
assertThat(ElasticVersion.forVersion("6.4.0")).isEqualTo(ElasticVersion.V6_4);
assertThat(ElasticVersion.forVersion("6.4.1")).isEqualTo(ElasticVersion.V6_4);

View File

@ -408,6 +408,10 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
return commentLinkSections;
}
public void addCommentLinkSection(CommentLinkInfoImpl commentLink) {
commentLinkSections.add(commentLink);
}
public ConfiguredMimeTypes getMimeTypes() {
return mimeTypes;
}
@ -967,7 +971,6 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
rc.getString(COMMENTLINK, name, KEY_MATCH), name, e.getMessage())));
}
}
commentLinkSections = ImmutableList.copyOf(commentLinkSections);
}
private void loadSubscribeSections(Config rc) throws ConfigInvalidException {
@ -1160,6 +1163,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
savePluginSections(rc, keepGroups);
groupList.retainUUIDs(keepGroups);
saveLabelSections(rc);
saveCommentLinkSections(rc);
saveSubscribeSections(rc);
saveConfig(PROJECT_CONFIG, rc);
@ -1445,6 +1449,23 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
}
}
private void saveCommentLinkSections(Config rc) {
if (commentLinkSections != null) {
for (CommentLinkInfoImpl cm : commentLinkSections) {
rc.setString(COMMENTLINK, cm.name, KEY_MATCH, cm.match);
if (!Strings.isNullOrEmpty(cm.html)) {
rc.setString(COMMENTLINK, cm.name, KEY_HTML, cm.html);
}
if (!Strings.isNullOrEmpty(cm.link)) {
rc.setString(COMMENTLINK, cm.name, KEY_LINK, cm.link);
}
if (cm.enabled != null && !cm.enabled) {
rc.setBoolean(COMMENTLINK, cm.name, KEY_ENABLED, cm.enabled);
}
}
}
}
private static void setBooleanConfigKey(
Config rc, String section, String name, String key, boolean value, boolean defaultValue) {
if (value == defaultValue) {

View File

@ -54,7 +54,8 @@ public class ListMailFilter implements MailFilter {
}
boolean match = mailPattern.matcher(message.from().email).find();
if (mode == ListFilterMode.WHITELIST && !match || mode == ListFilterMode.BLACKLIST && match) {
if ((mode == ListFilterMode.WHITELIST && !match)
|| (mode == ListFilterMode.BLACKLIST && match)) {
log.info("Mail message from " + message.from() + " rejected by list filter");
return false;
}

View File

@ -454,7 +454,7 @@ public class ChangeBundle {
excludeOrigSubj = true;
String aTopic = trimOrNull(a.getTopic());
excludeTopic =
Objects.equals(aTopic, b.getTopic()) || "".equals(aTopic) && b.getTopic() == null;
Objects.equals(aTopic, b.getTopic()) || ("".equals(aTopic) && b.getTopic() == null);
aUpdated = bundleA.getLatestTimestamp();
} else if (bundleA.source == NOTE_DB && bundleB.source == REVIEW_DB) {
boolean createdOnMatchesFirstPs =
@ -472,7 +472,7 @@ public class ChangeBundle {
excludeOrigSubj = true;
String bTopic = trimOrNull(b.getTopic());
excludeTopic =
Objects.equals(bTopic, a.getTopic()) || a.getTopic() == null && "".equals(bTopic);
Objects.equals(bTopic, a.getTopic()) || (a.getTopic() == null && "".equals(bTopic));
bUpdated = bundleB.getLatestTimestamp();
}
@ -776,7 +776,8 @@ public class ChangeBundle {
excludePostSubmit = a.getValue() == 0 && b.isPostSubmit();
} else if (bundleA.source == NOTE_DB && bundleB.source == REVIEW_DB) {
excludeGranted =
tb.before(psb.getCreatedOn()) && ta.equals(psa.getCreatedOn()) || tb.compareTo(ta) < 0;
(tb.before(psb.getCreatedOn()) && ta.equals(psa.getCreatedOn()))
|| (tb.compareTo(ta) < 0);
excludePostSubmit = b.getValue() == 0 && a.isPostSubmit();
}

View File

@ -29,6 +29,7 @@ import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.config.PluginConfig;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.project.CommentLinkInfoImpl;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.StandardKeyEncoder;
import java.io.IOException;
@ -484,6 +485,19 @@ public class ProjectConfigTest extends LocalDiskRepositoryTestCase {
+ "\n");
}
@Test
public void addCommentLink() throws Exception {
RevCommit rev = util.commit().create();
update(rev);
ProjectConfig cfg = read(rev);
CommentLinkInfoImpl cm = new CommentLinkInfoImpl("Test", "abc.*", null, "<a>link</a>", true);
cfg.addCommentLinkSection(cm);
rev = commit(cfg);
assertThat(text(rev, "project.config"))
.isEqualTo("[commentlink \"Test\"]\n\tmatch = abc.*\n\thtml = <a>link</a>\n");
}
private ProjectConfig read(RevCommit rev) throws IOException, ConfigInvalidException {
ProjectConfig cfg = new ProjectConfig(new Project.NameKey("test"));
cfg.load(db, rev);

View File

@ -44,7 +44,7 @@ default_java_toolchain(
default_java_toolchain(
name = "error_prone_warnings_toolchain",
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath8.jar"],
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
package_configuration = [
":error_prone",
],