Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-21213

[GSS](7.3.z) WFLY-14561 - Incorrect deserialization using getValue method

    XMLWordPrintable

Details

    • Hide
      • Obtain the yasson_test.zip in the upstream issue 342 .
      • Just run the tests:
      $ mvn test
      ...
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running yasson.test.RootTest
      Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.167 sec <<< FAILURE!
      test(yasson.test.RootTest)  Time elapsed: 0.079 sec  <<< FAILURE!
      java.lang.AssertionError: expected:<string> but was:<null>
      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.failNotEquals(Assert.java:834)
      	at org.junit.Assert.assertEquals(Assert.java:118)
      	at org.junit.Assert.assertEquals(Assert.java:144)
      	at yasson.test.RootTest.test(RootTest.java:21)
      ...
      
      Show
      Obtain the yasson_test.zip in the upstream issue 342 . Just run the tests: $ mvn test ... ------------------------------------------------------- T E S T S ------------------------------------------------------- Running yasson.test.RootTest Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.167 sec <<< FAILURE! test(yasson.test.RootTest) Time elapsed: 0.079 sec <<< FAILURE! java.lang.AssertionError: expected:<string> but was:<null> at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:834) at org.junit.Assert.assertEquals(Assert.java:118) at org.junit.Assert.assertEquals(Assert.java:144) at yasson.test.RootTest.test(RootTest.java:21) ...
    • Workaround Exists
    • Hide

      Don't use the parser getValue method in the deserializer. Use getObject or getArray instead.

      Show
      Don't use the parser getValue method in the deserializer. Use getObject or getArray instead.
    • +

    Description

      It's the same issue explained in the upstream yasson project: issue 342 . If a custom deserializer uses the getValue method the level is not updated in the same way that happens when getObject or getArray methods are executed. That method javadoc says:

      Returns a JsonValue at the current parser position. If the parser state is START_ARRAY, the behavior is the same as getArray(). If the parser state is START_OBJECT, the behavior is the same as getObject(). For all other cases, if applicable, the JSON value is read and returned.

      So it's clear that the getValue method should act exactly in the same way of the other methods in case of an array or an object.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-rmartinc Ricardo Martin Camarero
              rhn-support-rmartinc Ricardo Martin Camarero
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: