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

Adam Long commented on LOG4J2-3131:
-----------------------------------

For what it's worth, here's the JSON that is being worked on:


{code:json}
{
  "instant" : {
    "epochSecond" : 1627411715,
    "nanoOfSecond" : 689093000
  },
  "thread" : "main",
  "level" : "ERROR",
  "loggerName" : "example.Main",
  "message" : "Hello World",
  "thrown" : {
    "commonElementCount" : 0,
    "localizedMessage" : "java.lang.IllegalArgumentException: This is a test",
    "message" : "java.lang.IllegalArgumentException: This is a test",
    "name" : "java.lang.RuntimeException",
    "cause" : {
      "commonElementCount" : 1,
      "localizedMessage" : "This is a test",
      "message" : "This is a test",
      "name" : "java.lang.IllegalArgumentException",
      "cause" : {
        "commonElementCount" : 1,
        "localizedMessage" : "Third Exception",
        "message" : "Third Exception",
        "name" : "java.lang.RuntimeException"
      }
    },
    "extendedStackTrace" : [ {
      "class" : "example.Main",
      "method" : "main",
      "file" : "Main.java",
      "line" : 8,
      "exact" : true,
      "location" : "classes/",
      "version" : "?"
    } ]
  },
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger",
  "threadId" : 1,
  "threadPriority" : 5
}

{code}


> Attempting to call getExtendedStackTraceAsString() after deserializing JSON 
> LogEvent results in a NPE
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-3131
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3131
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>    Affects Versions: 2.14.1
>            Reporter: Adam Long
>            Priority: Major
>         Attachments: example.zip
>
>
> How to reproduce:
>  # Generate a LogEvent with an Exception that has at least one cause (i.e. 
> nested Exception)
>  # Use the standard JSON Layout to turn that LogEvent into JSON
>  # Using JsonLogEventParser to turn it back into a LogEvent
>  # Call getExtendedStackTraceAsString() on the ThrowableProxy associated with 
> the deserialized LogEvent
>  # A NullPointerException will be thrown
> I've attached a small example project to reproduce the error.  



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

Reply via email to