stefan-egli commented on code in PR #7:
URL: 
https://github.com/apache/sling-org-apache-sling-discovery-base/pull/7#discussion_r924417028


##########
src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyConnectorServlet.java:
##########
@@ -206,39 +203,37 @@ protected void doPut(HttpServletRequest request, 
HttpServletResponse response)
         }
 
         final String[] pathInfo = request.getPathInfo().split("\\.");
-        final String extension = pathInfo.length==3 ? pathInfo[2] : "";
+        final String extension = pathInfo.length == 3 ? pathInfo[2] : "";
         if (!"json".equals(extension)) {
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
             return;
         }
-        
-        final String selector = pathInfo.length==3 ? pathInfo[1] : "";
+
+        final String selector = pathInfo.length == 3 ? pathInfo[1] : "";
 
         String topologyAnnouncementJSON = 
requestValidator.decodeMessage(request);
-       if (logger.isDebugEnabled()) {
-               logger.debug("doPost: incoming topology announcement is: "
-                       + topologyAnnouncementJSON);
-       }
+
+        // javasecurity:S5145: Replace pattern-breaking characters
+        logger.debug("doPost: incoming topology announcement is: " + 
topologyAnnouncementJSON.replaceAll("[\n\r\t]", "_"));

Review Comment:
   very minor, but what about keeping the `isDebugEnabled()` guard?
   
   ```suggestion
           if (logger.isDebugEnabled()) {
               // javasecurity:S5145: Replace pattern-breaking characters
               logger.debug("doPost: incoming topology announcement is: " + 
topologyAnnouncementJSON.replaceAll("[\n\r\t]", "_"));
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to