Apache log4j logo Apache logging services logo

CPD Results

The following document contains the results of PMD's CPD 5.6.1.

Duplications

File Line
org/apache/logging/log4j/audit/rest/RequestContextFilter.java 84
org/apache/logging/log4j/audit/rest/RequestContextHandlerInterceptor.java 48
                Enumeration<String> headers = request.getHeaderNames();
                while (headers.hasMoreElements()) {
                    String name = headers.nextElement();
                    RequestContextMapping mapping = mappings.getMappingByHeader(name);
                    logger.debug("Got Mapping:{} for Header:{}", mapping, name);
                    if (mapping != null) {
                        if (mapping.isChained()) {
                            ThreadContext.put(mapping.getChainKey(), request.getHeader(name));
                            logger.debug("Setting Context Key:{} with value:{}", mapping.getChainKey(), request.getHeader(name));
                            String value = ((ChainedMapping)mapping).getSupplier().get();
                            ThreadContext.put(mapping.getFieldName(), value);
                            logger.debug("Setting Context Key:{} with value:{}", mapping.getFieldName(), value);
                        } else {
                            ThreadContext.put(mapping.getFieldName(), request.getHeader(name));
                            logger.debug("Setting Context Key:{} with value:{}", mapping.getFieldName(), request.getHeader(name));
                        }
                    }
                }