From c0a1417173b1900d3d42cef0b4ebb22125322ab0 Mon Sep 17 00:00:00 2001 From: valentinogiardino Date: Fri, 23 Aug 2024 19:05:27 -0300 Subject: [PATCH] #29165 use final and Objects.isNull() --- .../main/java/com/dotmarketing/servlets/ShortyServlet.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java b/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java index ac70756d7ca0..f17548d4534a 100644 --- a/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java +++ b/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java @@ -2,6 +2,7 @@ import com.dotcms.variant.business.web.VariantWebAPI.RenderContext; import java.io.IOException; +import java.util.Objects; import java.util.Optional; import java.util.StringTokenizer; import java.util.regex.Matcher; @@ -538,9 +539,9 @@ protected final String inodePath(final Contentlet contentlet, .append(StringPool.FORWARD_SLASH).append(field.variable()).toString(); } - private void validateContentlet(Contentlet contentlet, boolean live, String inode) throws DotDataException { - if (contentlet == null) { - String versionType = live ? PageMode.LIVE.name() : PageMode.WORKING.name(); + private void validateContentlet(final Contentlet contentlet, final boolean live, final String inode) throws DotDataException { + if (Objects.isNull(contentlet)) { + final String versionType = live ? PageMode.LIVE.name() : PageMode.WORKING.name(); throw new DotDataException(String.format("No contentlet found for %s inode %s", versionType, inode)); } }