cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashaki...@apache.org
Subject [cxf] branch CXF-8359_mask_senstive_logging_fix_attribute updated: CXF-8359: updated null checks
Date Tue, 03 Nov 2020 00:02:24 GMT
This is an automated email from the ASF dual-hosted git repository.

ashakirin pushed a commit to branch CXF-8359_mask_senstive_logging_fix_attribute
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/CXF-8359_mask_senstive_logging_fix_attribute
by this push:
     new 9a53209  CXF-8359: updated null checks
9a53209 is described below

commit 9a53209683921b860e4c13e8418e37534f2ad4ab
Author: ashakirin <49843238+ashakirin-talend@users.noreply.github.com>
AuthorDate: Tue Nov 3 01:02:02 2020 +0100

    CXF-8359: updated null checks
---
 .../java/org/apache/cxf/ext/logging/MaskSensitiveHelper.java   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/MaskSensitiveHelper.java
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/MaskSensitiveHelper.java
index f9cf1a9..51361a9 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/MaskSensitiveHelper.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/MaskSensitiveHelper.java
@@ -20,7 +20,6 @@ package org.apache.cxf.ext.logging;
 
 import java.util.HashSet;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Pattern;
 
@@ -71,15 +70,14 @@ public class MaskSensitiveHelper {
             final Message message,
             final String originalLogString) {
         if (replacementsXML.isEmpty() && replacementsJSON.isEmpty()
-                || originalLogString == null) {
+                || originalLogString == null || message == null) {
             return originalLogString;
         }
-        final Optional<String> contentType = Optional.ofNullable(message)
-                .map(m -> (String) m.get(Message.CONTENT_TYPE));
-        if (!contentType.isPresent()) {
+        final String contentType = (String) message.get(Message.CONTENT_TYPE);
+        if (contentType == null) {
             return originalLogString;
         }
-        final String lowerCaseContentType = contentType.get().toLowerCase();
+        final String lowerCaseContentType = contentType.toLowerCase();
         if (lowerCaseContentType.contains(XML_CONTENT)
                 || lowerCaseContentType.contains(HTML_CONTENT)) {
             return applyMasks(originalLogString, replacementsXML);


Mime
View raw message