Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-42548

No workflow actions on issues due to SQL exception in Create/Edit screen

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Problem

      Users discover that certain issues are not able to be transitioned (e.g. Done, Fixed, etc.)

      For at least one customer this problem can occur when a SQL exception happens during issue creation. Custom fields of type URL are limited to 255 characters but in JIRA 6.4.4 this is not enforced by validation in the UI. When using MySQL this results in a SQL exception and creation of a partial issue record which can not be indexed.

      This is a possible regression of JRA-4241.

      Workaround: Integrity Checker

      Running integrity checker will solve the problem

      Workaround: Field validation using Script Runner Behaviours

      If users report a SQL exception when creating issues you can prevent this by adding validation behaviors to the custom fields.

      This is useful for JIRA versions prior to 6.4.12 when you have many workflows and transitions so adding a validation to all of them would be too time consuming.

      1. Install the Script Runner add-on which provides the Behaviours feature.
      2. Navigate to JIRA_BASE_URL/secure/admin/Behaviours!default.jspa
      3. Create a new Behavior
      4. Click on the "Fields" link next to the newly created Behaviour
      5. Add the field(s) you want to protect with the behavior.
      6. For each field click "Add serverside script" and insert Groovy scripting to check the field length. Example:
        def url_field = getFieldById(getFieldChanged())
        if (url_field == null) {
          return 0;
        }
        def value = url_field.getValue();
        if (value == null) {
          return 0;
        }
        if (value.length() > 255) {
          url_field.setError("URL is too long, must be less than 255 characters.");
        } else {
          url_field.clearError();
        }
        

      Workaround: Add workflow validations

      If users report a SQL exception when creating issues you can prevent this by adding validation to transitions in your workflow.

      This is useful for JIRA versions prior to 6.4.12 when you do not have many workflows/transitions or you cannot purchase the Script Runner add-on.

      1. Install the JIRA Suite Utilities add-on (free)
      2. Edit the workflow
      3. For the Create transition add a validation.
      4. Choose the regular expression validation.
      5. Enter this regular expression to limit a field to 255 characters:
        
        

        ^[^\s]

        {0,255}

        ${code}

        • Here's a screenshot of the configuration screen:

      Attachments

        1. Long-URL-Exception.png
          Long-URL-Exception.png
          147 kB
        2. Regular-Expression-Length-Check.png
          Regular-Expression-Length-Check.png
          116 kB
        3. Workaround-BehaviorFix.png
          Workaround-BehaviorFix.png
          131 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              smackie@atlassian.com Shannon S
              Votes:
              6 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: