From 95e393b6f79f259ccb65975a9be7aa144006f3bf Mon Sep 17 00:00:00 2001 From: erickgonzalez Date: Thu, 14 Nov 2024 15:32:52 -0600 Subject: [PATCH] fix: use UtilMethods.isSet instead of comparing against null. ref: #30130 (#30663) This pull request includes a small but important change to the `VanityUrlAPIImpl.java` file. The change improves the way query strings are handled when constructing new URLs. * [`dotCMS/src/main/java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java`](diffhunk://#diff-1b71d209a0e8438b81297d8be0bf3b1868c489d30114645b3e0974025de9d5c2L380-R380): Replaced the null check for `queryString` with a call to `UtilMethods.isSet(queryString)` to improve readability and consistency. --- .../java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotCMS/src/main/java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java b/dotCMS/src/main/java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java index 48c7f0f42a1b..a50934474ebe 100644 --- a/dotCMS/src/main/java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java +++ b/dotCMS/src/main/java/com/dotcms/vanityurl/business/VanityUrlAPIImpl.java @@ -377,7 +377,7 @@ public boolean handleVanityURLRedirects(final VanityUrlRequestWrapper request, f final String queryString = request.getQueryString(); final int responseCode = request.getResponseCode(); - final String newUrl = uri + (queryString != null ? StringPool.QUESTION + queryString : StringPool.BLANK); + final String newUrl = uri + (UtilMethods.isSet(queryString) ? StringPool.QUESTION + queryString : StringPool.BLANK); if (responseCode == 301 || responseCode == 302) { response.setStatus(responseCode);