You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Avinash Tripathy (Jira)" <ji...@apache.org> on 2021/06/09 05:29:00 UTC

[jira] [Comment Edited] (LOG4J2-3104) '{}' is not able to be appended with the empty attribute in json.

    [ https://issues.apache.org/jira/browse/LOG4J2-3104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17359763#comment-17359763 ] 

Avinash Tripathy edited comment on LOG4J2-3104 at 6/9/21, 5:28 AM:
-------------------------------------------------------------------

Sorry, Now I have attached the result also.

Please check the additionalData attribute.

Expected result should be the same as the input string.

 


was (Author: avinash.tripathy):
Sorry, Now I have attached the result also.

Please check the additionalData attribute.

 

> '{}' is not able to be appended with the empty attribute in json.
> -----------------------------------------------------------------
>
>                 Key: LOG4J2-3104
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3104
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.11.2
>            Reporter: Avinash Tripathy
>            Priority: Major
>
> {code:java}
> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
>  <dependency>
>    <groupId>org.apache.logging.log4j</groupId>
>    <artifactId>log4j-api</artifactId>
>    <version>2.11.2</version>
>  </dependency>{code}
>  
> *sample code:*
>  
>  
> {code:java}
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
> public class Log4jIssue {
>     private static final Logger LOGGER = LogManager.getLogger(Log4jIssue.class);
>     public static void main(String[] args) throws Exception {
>         String inputJson = "{\"metadata\":{\"Id\":\"191812\",\"operation\":\"UPDATE\",\"reason\":null}" +
>                            ",\"data\":{\"producerType\":null,\"producerName\":\"Test\",\"village\":null,\"additionalData\":{}," +
>                            "\"producerMiddleName\":\"\",\"producerLastName\":\"K\",\"producerGender\":\"FEMALE\",\"producerSalutation\":null}}";
>         LOGGER.info("inputJson : {}", inputJson);
>     }
> }
> {code}
>  
> *result*
>  
> {code:java}
> {
>   "metadata": {
>     "Id": "191812",
>     "operation": "UPDATE",
>     "reason": null
>   },
>   "data": {
>     "producerType": null,
>     "producerName": "Test",
>     "village": null,
>     "additionalData": {
>       "metadata": {
>         "Id": "191812",
>         "operation": "UPDATE",
>         "reason": null
>       },
>       "data": {
>         "producerType": null,
>         "producerName": "Test",
>         "village": null,
>         "additionalData": {
>           
>         },
>         "producerMiddleName": "",
>         "producerLastName": "K",
>         "producerGender": "FEMALE",
>         "producerSalutation": null
>       }
>     },
>     "producerMiddleName": "",
>     "producerLastName": "K",
>     "producerGender": "FEMALE",
>     "producerSalutation": null
>   }
> }
> {code}
>  
>  
> *Issue*: additionalData attribute is getting modified with complete json instead of empty.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)