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

ObjectValue throws NullPointerExcption after upgrade to 7.9

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Won't Fix
    • L2 - Critical
    • None
    • 7.9.0
    • engine
    • None

    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

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              mvlasaty Michael Vlasaty
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce