Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14331

NullPointerException in camunda-spin when serializing map containing null value

      Environment (Required on creation):

      Tested with spring camunda starter 7.16.2-ee and spin 1.9.0.

      Support ticket: SUPPORT-12786

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      camunda-spin throws NullPointerException with maps containing null values. Probably sets with null values would fail too.

      Steps to reproduce (Required on creation):

      Create a map with null values and try to serialize it with spin.

      See this example: https://github.com/daniel-ewing/spring-boot-spin1/tree/map-with-null-value

      Observed Behavior (Required on creation):

      NullPointerException

      Expected behavior (Required on creation):

      Spin should serialize maps with null values successfully (and sets too).

      Root Cause (Required on prioritization):

      Spin tries to construct a type for the key and value. With null value the value.getClass line throws a NPE in the TypeHelper class:

      org/camunda/spin/impl/json/jackson/format/TypeHelper.java:78

      Solution Ideas (Optional):

      • Introduce null check. Try to determine the value type by looking at other, non-null values, or store Object as type (since iterating a full map can be expensive)
      • Make sure to to test it for Set with null value.
      • What if a map only contains a single entry with null value? We can't determine the type... Store Object as type.

      Hints (optional):

      -

        This is the controller panel for Smart Panels app

            [CAM-14331] NullPointerException in camunda-spin when serializing map containing null value

            Daniel Kelemen created issue -
            Daniel Kelemen made changes -
            Description Original: h3. Environment (Required on creation):

            Tested with spring camunda starter 7.16.2-ee and spin 1.9.0.

            Support ticket: SUPPORT-12786
            h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            camunda-spin throws NullPointerException with maps containing null values. Probably sets with null values would fail too.
            h3. Steps to reproduce (Required on creation):

            Create a map with null values and try to serialize it with spin.

            See this example: [https://github.com/daniel-ewing/spring-boot-spin1/tree/map-with-null-value]
            h3. Observed Behavior (Required on creation):

            NullPointerException
            h3. Expected behavior (Required on creation):

            Spin should serialize maps with null values in it (and sets too).
            h3. Root Cause (Required on prioritization):

            Spin tries to construct a type for each key and value. With null value the {{value.getClass}} line throws a NPE in the {{{}TypeHelper class{}}}:

            {{org/camunda/spin/impl/json/jackson/format/TypeHelper.java:78}}
            h3. Solution Ideas (Optional):

            Introduce null check. Try to determine the key type by looking at other, non-null values.

            Make sure to to test it for Set with null value.
            h3. Hints (optional):
            New: h3. Environment (Required on creation):

            Tested with spring camunda starter 7.16.2-ee and spin 1.9.0.

            Support ticket: SUPPORT-12786
            h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            camunda-spin throws NullPointerException with maps containing null values. Probably sets with null values would fail too.
            h3. Steps to reproduce (Required on creation):

            Create a map with null values and try to serialize it with spin.

            See this example: [https://github.com/daniel-ewing/spring-boot-spin1/tree/map-with-null-value]
            h3. Observed Behavior (Required on creation):

            NullPointerException
            h3. Expected behavior (Required on creation):

            Spin should serialize maps with null values successfully (and sets too).
            h3. Root Cause (Required on prioritization):

            Spin tries to construct a type for each key and value. With null value the {{value.getClass}} line throws a NPE in the {{{}TypeHelper class{}}}:

            {{org/camunda/spin/impl/json/jackson/format/TypeHelper.java:78}}
            h3. Solution Ideas (Optional):

            Introduce null check. Try to determine the key type by looking at other, non-null values.

            Make sure to to test it for Set with null value.
            h3. Hints (optional):
            Daniel Kelemen made changes -
            Mentioned Roles
            Daniel Kelemen made changes -
            Mentioned Groups
            Daniel Kelemen made changes -
            Summary Original: NullPointerException when serializing map containing null value New: NullPointerException in camunda-spin when serializing map containing null value
            Daniel Ewing made changes -
            Labels New: SUPPORT
            Daniel Kelemen made changes -
            Description Original: h3. Environment (Required on creation):

            Tested with spring camunda starter 7.16.2-ee and spin 1.9.0.

            Support ticket: SUPPORT-12786
            h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            camunda-spin throws NullPointerException with maps containing null values. Probably sets with null values would fail too.
            h3. Steps to reproduce (Required on creation):

            Create a map with null values and try to serialize it with spin.

            See this example: [https://github.com/daniel-ewing/spring-boot-spin1/tree/map-with-null-value]
            h3. Observed Behavior (Required on creation):

            NullPointerException
            h3. Expected behavior (Required on creation):

            Spin should serialize maps with null values successfully (and sets too).
            h3. Root Cause (Required on prioritization):

            Spin tries to construct a type for each key and value. With null value the {{value.getClass}} line throws a NPE in the {{{}TypeHelper class{}}}:

            {{org/camunda/spin/impl/json/jackson/format/TypeHelper.java:78}}
            h3. Solution Ideas (Optional):

            Introduce null check. Try to determine the key type by looking at other, non-null values.

            Make sure to to test it for Set with null value.
            h3. Hints (optional):
            New: h3. Environment (Required on creation):

            Tested with spring camunda starter 7.16.2-ee and spin 1.9.0.

            Support ticket: SUPPORT-12786
            h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            camunda-spin throws NullPointerException with maps containing null values. Probably sets with null values would fail too.
            h3. Steps to reproduce (Required on creation):

            Create a map with null values and try to serialize it with spin.

            See this example: [https://github.com/daniel-ewing/spring-boot-spin1/tree/map-with-null-value]
            h3. Observed Behavior (Required on creation):

            NullPointerException
            h3. Expected behavior (Required on creation):

            Spin should serialize maps with null values successfully (and sets too).
            h3. Root Cause (Required on prioritization):

            Spin tries to construct a type for each key and value. With null value the {{value.getClass}} line throws a NPE in the {{{}TypeHelper class{}}}:

            {{org/camunda/spin/impl/json/jackson/format/TypeHelper.java:78}}
            h3. Solution Ideas (Optional):

            Introduce null check. Try to determine the key type by looking at other, non-null values.

            Make sure to to test it for Set with null value.

            What if a map only contains a single entry with null value? We can't determine the type... Store {{Object}} as type.
            h3. Hints (optional):
            Labels Original: SUPPORT
            Daniel Kelemen made changes -
            Mentioned Roles
            Daniel Kelemen made changes -
            Mentioned Groups
            Daniel Ewing made changes -
            Link New: This issue is related to SUPPORT-12786 [ SUPPORT-12786 ]

              tassilo.weidner Tassilo Weidner
              daniel.kelemen Daniel Kelemen
              Tassilo Weidner Tassilo Weidner
              Daniel Kelemen Daniel Kelemen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: