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

make exception include the name of the variable if FormFieldHandler.createFormField fails

    Details

    • Type: Feature Request
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: 7.10.0
    • Fix Version/s: 7.12.0, 7.12.0-alpha1
    • Component/s: engine
    • Labels:
      None
    • Environment:
      Tomcat, Debian Linux

      Description

      With the released version of Camunda, I get an exception like this:

      01-Jun-2019 12:22:15.393 SEVERE [http-nio-8080-exec-9] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: failed to convert '
      arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: ""
       org.camunda.bpm.engine.impl.form.validator.FormFieldValidationException: failed to convert 'arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: "
      "
              at org.camunda.bpm.engine.impl.form.handler.FormFieldHandler.createFormField(FormFieldHandler.java:91)
              at org.camunda.bpm.engine.impl.form.handler.DefaultFormHandler.initializeFormFields(DefaultFormHandler.java:278)
              at org.camunda.bpm.engine.impl.form.handler.DefaultTaskFormHandler.createTaskForm(DefaultTaskFormHandler.java:44)
              at org.camunda.bpm.engine.impl.form.handler.CreateTaskFormInvocation.invoke(CreateTaskFormInvocation.java:37)
              at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:57)
              at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:90)
              at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:62)
              at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:41)
              at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:36)
              at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.doCall(DelegateFormHandler.java:69)
              at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler$1.call(DelegateFormHandler.java:57)
              at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:47)
              at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
              at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:128)
              at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:194)
              at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:181)
              at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.performContextSwitch(DelegateFormHandler.java:55)
              at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler.createTaskForm(DelegateTaskFormHandler.java:36)
              at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:56)
              at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:34)
              at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:27)
              at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:106)
              at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:69)
              at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
              at org.camunda.bpm.engine.impl.FormServiceImpl.getTaskFormData(FormServiceImpl.java:66)
              at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.getForm(TaskResourceImpl.java:186)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
              at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
              at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
              at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
              at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
              at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
              at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
              at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
      

      which doesn't tell me which form field caused the problem.

      It would be nice to catch the exception in FormFieldHandler.createField and rethrow it as a FormFieldValidationException so that we can include the name of the offending variable.

        Activity

        Hide
        DavidHodges David Hodges added a comment -

        I have create a pull request for this: https://github.com/camunda/camunda-bpm-platform/pull/341

        Show
        DavidHodges David Hodges added a comment - I have create a pull request for this: https://github.com/camunda/camunda-bpm-platform/pull/341
        Hide
        miklas.boskamp Miklas Boskamp added a comment -

        Hi David Hodges,

        Thank you very much for your contribution. I've looked into the changes you made.
        The provided stacktrace does not show an exception in the createFormFields method but int the handleSubmit method of the FormFieldHandler:

        at org.camunda.bpm.engine.impl.form.handler.FormFieldHandler.handleSubmit(FormFieldHandler.java:129)

        The changes you introduce in your PR do not change this method, though.
        Could you give more information on why these changes solve your problem? How can this error be reproduced?

        Another note: Although adding a test case for this is optional (since we usually don't test exception messages) you could be more assured that the introduced behavior won't change in the future.

        Cheers,
        Miklas

        Show
        miklas.boskamp Miklas Boskamp added a comment - Hi David Hodges , Thank you very much for your contribution. I've looked into the changes you made. The provided stacktrace does not show an exception in the createFormFields method but int the handleSubmit method of the FormFieldHandler: at org.camunda.bpm.engine.impl.form.handler.FormFieldHandler.handleSubmit(FormFieldHandler.java:129) The changes you introduce in your PR do not change this method, though. Could you give more information on why these changes solve your problem? How can this error be reproduced? Another note: Although adding a test case for this is optional (since we usually don't test exception messages) you could be more assured that the introduced behavior won't change in the future. Cheers, Miklas
        Hide
        DavidHodges David Hodges added a comment -

        The error was caused by declaring the variable as a String in one form, then declaring it as a Long in a later form. So the error occurs when it tries to display the second form.

        Show
        DavidHodges David Hodges added a comment - The error was caused by declaring the variable as a String in one form, then declaring it as a Long in a later form. So the error occurs when it tries to display the second form.
        Hide
        DavidHodges David Hodges added a comment - - edited

        Sorry, I submitted the wrong stack trace - that was for a different exception.
        The correct stack trace is as follows:

        01-Jun-2019 12:22:15.393 SEVERE [http-nio-8080-exec-9] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: failed to convert '
        arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: ""
         org.camunda.bpm.engine.impl.form.validator.FormFieldValidationException: failed to convert 'arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: "
        "
                at org.camunda.bpm.engine.impl.form.handler.FormFieldHandler.createFormField(FormFieldHandler.java:91)
                at org.camunda.bpm.engine.impl.form.handler.DefaultFormHandler.initializeFormFields(DefaultFormHandler.java:278)
                at org.camunda.bpm.engine.impl.form.handler.DefaultTaskFormHandler.createTaskForm(DefaultTaskFormHandler.java:44)
                at org.camunda.bpm.engine.impl.form.handler.CreateTaskFormInvocation.invoke(CreateTaskFormInvocation.java:37)
                at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:57)
                at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:90)
                at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:62)
                at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:41)
                at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:36)
                at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.doCall(DelegateFormHandler.java:69)
                at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler$1.call(DelegateFormHandler.java:57)
                at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:47)
                at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
                at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:128)
                at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:194)
                at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:181)
                at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.performContextSwitch(DelegateFormHandler.java:55)
                at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler.createTaskForm(DelegateTaskFormHandler.java:36)
                at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:56)
                at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:34)
                at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:27)
                at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:106)
                at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:69)
                at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
                at org.camunda.bpm.engine.impl.FormServiceImpl.getTaskFormData(FormServiceImpl.java:66)
                at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.getForm(TaskResourceImpl.java:186)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
                at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
                at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
                at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
                at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
                at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
                at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
                at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
        
        Show
        DavidHodges David Hodges added a comment - - edited Sorry, I submitted the wrong stack trace - that was for a different exception. The correct stack trace is as follows: 01-Jun-2019 12:22:15.393 SEVERE [http-nio-8080-exec-9] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: failed to convert ' arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: "" org.camunda.bpm.engine.impl.form.validator.FormFieldValidationException: failed to convert 'arrayAzimuthDegrees' caused by java.lang.NumberFormatException: For input string: " " at org.camunda.bpm.engine.impl.form.handler.FormFieldHandler.createFormField(FormFieldHandler.java:91) at org.camunda.bpm.engine.impl.form.handler.DefaultFormHandler.initializeFormFields(DefaultFormHandler.java:278) at org.camunda.bpm.engine.impl.form.handler.DefaultTaskFormHandler.createTaskForm(DefaultTaskFormHandler.java:44) at org.camunda.bpm.engine.impl.form.handler.CreateTaskFormInvocation.invoke(CreateTaskFormInvocation.java:37) at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:57) at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:90) at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:62) at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:41) at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler$1.call(DelegateTaskFormHandler.java:36) at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.doCall(DelegateFormHandler.java:69) at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler$1.call(DelegateFormHandler.java:57) at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:47) at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117) at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:128) at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:194) at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:181) at org.camunda.bpm.engine.impl.form.handler.DelegateFormHandler.performContextSwitch(DelegateFormHandler.java:55) at org.camunda.bpm.engine.impl.form.handler.DelegateTaskFormHandler.createTaskForm(DelegateTaskFormHandler.java:36) at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:56) at org.camunda.bpm.engine.impl.cmd.GetTaskFormCmd.execute(GetTaskFormCmd.java:34) at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:27) at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:106) at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:69) at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32) at org.camunda.bpm.engine.impl.FormServiceImpl.getTaskFormData(FormServiceImpl.java:66) at org.camunda.bpm.engine. rest .sub.task.impl.TaskResourceImpl.getForm(TaskResourceImpl.java:186) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159) at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107) at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154) at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
        Hide
        miklas.boskamp Miklas Boskamp added a comment -

        Hi David Hodges,

        I have reviewed your pull request and it looks good. If you would like to submit a test case for your changes please let me know. Otherwise, I will merge this into master.
        A test case would make your changes more future proof, as behavior covered by tests is more likely to stay unchanged.

        Cheers,
        Miklas

        Show
        miklas.boskamp Miklas Boskamp added a comment - Hi David Hodges , I have reviewed your pull request and it looks good. If you would like to submit a test case for your changes please let me know. Otherwise, I will merge this into master. A test case would make your changes more future proof, as behavior covered by tests is more likely to stay unchanged. Cheers, Miklas
        Hide
        miklas.boskamp Miklas Boskamp added a comment -

        Hi David Hodges,

        since I did not hear from you regarding test coverage I will just merge your changes. Thanks again for your contribution.

        Have a great day!
        Cheers,
        Miklas

        Show
        miklas.boskamp Miklas Boskamp added a comment - Hi David Hodges , since I did not hear from you regarding test coverage I will just merge your changes. Thanks again for your contribution. Have a great day! Cheers, Miklas

          People

          • Assignee:
            miklas.boskamp Miklas Boskamp
            Reporter:
            DavidHodges David Hodges
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development