Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.2
    • Fix Version/s: 2.9.0
    • Component/s: API
    • Labels:
      None

      Description

      From https://github.com/apache/logging-log4j2/pull/78:

      To pass FormattedMessage completely we should pass string values from argArray together with argArray.length.
      For now there is such bug: on readObject it's InputStream brings length of stringArgs but there is no values in InputStream to read. So if length > 0 there will be EOFException while reading null value from InputStream.

      The unit test without the fix yields:

      java.io.EOFException
      	at java.base/java.io.DataInputStream.readUnsignedShort(Unknown Source)
      	at java.base/java.io.ObjectInputStream$BlockDataInputStream.readUnsignedShort(Unknown Source)
      	at java.base/java.io.ObjectInputStream$BlockDataInputStream.readUTF(Unknown Source)
      	at java.base/java.io.ObjectInputStream.readUTF(Unknown Source)
      	at org.apache.logging.log4j.message.FormattedMessage.readObject(FormattedMessage.java:241)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      	at java.base/java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
      	at java.base/java.io.ObjectInputStream.readSerialData(Unknown Source)
      	at java.base/java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      	at java.base/java.io.ObjectInputStream.readObject0(Unknown Source)
      	at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
      	at org.apache.logging.log4j.message.FormattedMessageTest.testSerialization(FormattedMessageTest.java:169)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 687bd523e3efe0c1b7d65a65a9abd995f9083ad4 in logging-log4j2's branch refs/heads/master from Gary Gregory
        [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=687bd52 ]

        LOG4J2-1929 EOFException with FormattedMessage. Closes #78.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 687bd523e3efe0c1b7d65a65a9abd995f9083ad4 in logging-log4j2's branch refs/heads/master from Gary Gregory [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=687bd52 ] LOG4J2-1929 EOFException with FormattedMessage. Closes #78.
        Hide
        garydgregory Gary Gregory added a comment -

        In Git master; commit e89ac6e5b16d15497c12758665dbbfb1534eb13d.

        Show
        garydgregory Gary Gregory added a comment - In Git master; commit e89ac6e5b16d15497c12758665dbbfb1534eb13d.
        Hide
        garydgregory Gary Gregory added a comment -

        Closes #78.

        Show
        garydgregory Gary Gregory added a comment - Closes #78.

          People

          • Assignee:
            garydgregory Gary Gregory
            Reporter:
            garydgregory Gary Gregory
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development