Set hex value to null if value is null

Retain internal consistency in the code.

Since value is set to null if it is an empty string,
it makes sense to set valueHex to null if value
is null.

Co-authored-by: Basil Crow <me@basilcrow.com>
This commit is contained in:
Mark WaiteandBasil Crow authored and GitHub committed 2022-12-23 13:02:18 -07:00
1 parent fd2f7e817b
commit 89bca6705f
1 file changed
+1 -1
@@ -43,7 +43,7 @@ public class URICheckEncodingMonitor extends AdministrativeMonitor {
if (!expected.equals(value)) {
String expectedHex = Util.toHexString(expected.getBytes(StandardCharsets.UTF_8));
String valueHex = value != null ? Util.toHexString(value.getBytes(StandardCharsets.UTF_8)) : "<empty string>";
String valueHex = value != null ? Util.toHexString(value.getBytes(StandardCharsets.UTF_8)) : null;
LOGGER.log(Level.CONFIG, "Expected to receive: " + expected + " (" + expectedHex + ") but got: " + value + " (" + valueHex + ")");
return FormValidation.warningWithMarkup(hudson.model.Messages.Hudson_NotUsesUTF8ToDecodeURL());
}