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

ObjectValue throws NullPointerExcption after upgrade to 7.9

    Details

    • Type: Bug Report
    • Status: Open
    • Priority: L2 - Critical
    • Resolution: Unresolved
    • Affects Version/s: 7.9.0
    • Fix Version/s: None
    • Component/s: engine
    • Labels:
      None
    • Title Keywords:
      ObjectValue NullPointerException

      Description

      After upgrading camunda from version 7.8 to 7.9 all static calls to Variables.objectValue(someObject).create() as well as ObjectValue.create() are throwing NullPointerExceptions if one tries to unit test a single task without any application context due to the change of java serialization feature introduced in version 7.9.

      Here is a practical example of a unit test:

      @ActiveProfiles("test")
      @RunWith(SpringRunner.class)
      public class SimpleUnitTest {
          @TestConfiguration
          public static class SimpleUnitTestConfig {
              @Bean
              public TaskDelegate serviceTask() {
                  return new ServiceTask();
              }
          }
          
          @Autowired
          private TaskDelegate taskUnderTest;
      
      
          @Test
          public void doSomeTesting() {
              DelegateExecution exec = new ExecutionImpl();
              exec.setVariable("someObject", Variables.objectValue(this.object).create()); // NPE thrown here due to missing processEngineConfiguration
      
              this.taskUnderTest.execute(exec);
      
              assertThat(exec.getVariable("foo")).equals("bar");
          }
      }
      

      As the task delegate uses the typed value API, neither a POJO nor the ObjectValue call succeeds as either a NPE is thrown or an exception that this variable is not an ObjectValue.

      I would expect that this static call does not have any side effects nor requires the processEngienConfiguration from the context.

      Is there any way getting around that issue, as for most of the unit tests no application context is needed anyway? (concerning cycle time on CI/CD server)
      Could you please provide a working sample, couldn't find any matching to this issue.

      Regards

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            mvlasaty Michael Vlasaty
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development