Merge branch 'stable-3.0' into stable-3.1 * stable-3.0: Bump Bazel version to 3.5.0 Change-Id: I25b03e9d12c062f546155f15b9966efa5b3b2769
diff --git a/WORKSPACE b/WORKSPACE index c0230ee..9c6cb5d 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -3,7 +3,7 @@ load("//:bazlets.bzl", "load_bazlets") load_bazlets( - commit = "6d2b8f41ed34dad925b767399d1e4be378abb029", + commit = "3f9dadc615dc4053369a42d9ada37dafd8d4763c", #local_path = "/home/<user>/projects/bazlets", )
diff --git a/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/GetMessage.java b/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/GetMessage.java index c0181a5..255bb90 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/GetMessage.java +++ b/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/GetMessage.java
@@ -19,6 +19,7 @@ import com.google.common.base.Strings; import com.google.gerrit.extensions.annotations.PluginData; import com.google.gerrit.extensions.annotations.PluginName; +import com.google.gerrit.extensions.restapi.Response; import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.server.config.ConfigResource; import com.google.gerrit.server.config.SitePaths; @@ -61,7 +62,7 @@ } @Override - public MessageOfTheDayInfo apply(ConfigResource rsrc) { + public Response<MessageOfTheDayInfo> apply(ConfigResource rsrc) { MessageOfTheDayInfo motd = new MessageOfTheDayInfo(); cfg = new FileBasedConfig(cfgFile, FS.DETECTED); try { @@ -73,14 +74,14 @@ motd.id = cfg.getString(SECTION_MESSAGE, null, KEY_ID); if (Strings.isNullOrEmpty(motd.id)) { log.warn("id not defined, no message will be shown"); - return null; + return Response.none(); } try { motd.expiresAt = DATE_FORMAT.parse(cfg.getString(SECTION_MESSAGE, null, KEY_EXPIRES_AT)); } catch (ParseException | NullPointerException e) { log.warn("expiresAt not defined, no message will be shown"); - return null; + return Response.none(); } try { @@ -89,7 +90,7 @@ log.warn( String.format( "No HTML-file was found for message %s, no message will be shown", motd.id)); - return null; + return Response.none(); } try { @@ -100,12 +101,12 @@ } if (motd.startsAt.compareTo(new Date()) > 0 || motd.expiresAt.compareTo(new Date()) < 0) { - return null; + return Response.none(); } motd.redisplay = getRedisplay(); - return motd; + return Response.ok(motd); } private Date getRedisplay() {