[
https://issues.apache.org/jira/browse/LOG4J2-2578?focusedWorklogId=222721&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-222721
]
ASF GitHub Bot logged work on LOG4J2-2578:
------------------------------------------
Author: ASF GitHub Bot
Created on: 04/Apr/19 00:04
Start Date: 04/Apr/19 00:04
Worklog Time Spent: 10m
Work Description: rgoers commented on issue #18: LOG4J2-2578
URL:
https://github.com/apache/logging-log4j-audit/pull/18#issuecomment-479701143
This PR looks good to me.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 222721)
Time Spent: 20m (was: 10m)
> RequestContextMappings should ignore private and instance fields
> ----------------------------------------------------------------
>
> Key: LOG4J2-2578
> URL: https://issues.apache.org/jira/browse/LOG4J2-2578
> Project: Log4j 2
> Issue Type: Bug
> Components: Log4j-Audit
> Affects Versions: Log4j-Audit 1.0.1
> Environment: Java 11
> Reporter: Andrei Ivanov
> Priority: Blocker
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{RequestContextMappings}} inspects the user defined
> [class|https://github.com/apache/logging-log4j-audit-sample/blob/master/audit-service-war/src/main/java/org/apache/logging/log4j/audit/service/RequestContext.java]
> passed as a constructor parameter, but it checks
> [all|https://github.com/apache/logging-log4j-audit/blob/master/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/request/RequestContextMappings.java#L58]
> fields, instead of just the *public static* ones (at least that's what I
> understand it should do).
> In Java 8 the issue is covered by catching an {{IllegalAccessException}} when
> accessing the field value, but in Java 11 this throws a
> {{NullPointerException}} for non-static fields.
> The proposed solution would be to replace {{clazz.getDeclaredFields()}} with
> {{clazz.getFields()}}, to obtain only the accessible public fields, and then
> check them to process only the *static* ones.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)