Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-15459

Adding a blank space in front of the CRON expression in one Assets Report will make the entire Assets Reports page fail to load

      Issue Summary

      Adding a blank space in front of the CRON expression in one Assets Report will make the entire Assets Reports page fail to load with the following error message:

      Failed to fetch reports list
      
      Something went wrong. Please try again later. If the error persists, contact our support team.
      

      Steps to Reproduce

      1. Access the Assets Reports page: Assets > Report
      2. Create a Report
      3. Synchronize: Advanced
      4. For the Cron Schedule field add a CRON expression with a blank space in front, e.g:
         0 0 1 1 */3 ?
        
      5. Save and Refresh the page
      6. When refreshing the page, the entire Reports page will be blank with the "Failed to fetch reports list" error message. 

      Video Reproducing the issue: JSDSERVER-15459 - Reproducing the issue.mov

      Expected Results

      When entering an invalid CRON expression (with a blank space), the "Expression is not valid" will be presented not allowing the report to be saved. 

      Actual Results

      The report CRON Expression will be updated and the below exception will be thrown in the atlassian-jira.log file:

      2024-07-19 11:49:04,196-0300 http-nio-44226-exec-17 ERROR admin 709x1831x4 1xytyos 0:0:0:0:0:0:0:1 /rest/insight-widgets/1/widgets [i.r.core.rest.ExceptionErrorMapper] Oops
      java.lang.NumberFormatException: For input string: "?"
      	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.base/java.lang.Integer.parseInt(Integer.java:652)
      	at java.base/java.lang.Integer.parseInt(Integer.java:770)
      	at net.redhogs.cronparser.builder.YearDescriptionBuilder.getSingleItemDescription(YearDescriptionBuilder.java:22)
      	at net.redhogs.cronparser.builder.AbstractDescriptionBuilder.getSegmentDescription(AbstractDescriptionBuilder.java:25)
      	at net.redhogs.cronparser.CronExpressionDescriptor.getYearDescription(CronExpressionDescriptor.java:109)
      	at net.redhogs.cronparser.CronExpressionDescriptor.getFullDescription(CronExpressionDescriptor.java:245)
      	at net.redhogs.cronparser.CronExpressionDescriptor.getDescription(CronExpressionDescriptor.java:62)
      	at net.redhogs.cronparser.CronExpressionDescriptor.getDescription(CronExpressionDescriptor.java:39)
      	at io.riada.jira.plugins.insight.widget.model.Cron$Companion.descriptionOf(Cron.kt:80)
      	at io.riada.jira.plugins.insight.widget.model.Cron.translate(Cron.kt:27)
      

      Workaround

      We could manually fix the issue, we will need to identify the affected report CRON expression and update it or temporarily change the report synchronization to once:

      Warning

      Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.

      1. Run the following SQL query to list all the reports using the CRON expression:
        SELECT "ID", "NAME", "SYNC_PERIOD", "SYNC_PERIOD_CRON" FROM "AO_8542F1_IFJ_WIDGET" WHERE "SYNC_PERIOD" = 'ADVANCED' 
        
      2. Verify the SYNC_PERIOD_CRON and find the row with an invalid CRON expression (blank space in front of the CRON expression)e.g: 
      3. Temporarily update the affected report to SYNC_PERIOD Once, and fix the Cron using the UI. (Recommended )
        update "AO_8542F1_IFJ_WIDGET" SET "SYNC_PERIOD_CRON" = NULL, "SYNC_PERIOD" = 'ONCE'  WHERE "ID" = REPORT_ID;
        

        - Replace <REPORT_ID> with the affected Asset report ID.

      4. Or, update the CRON Expression column running the SQL query below:
        update "AO_8542F1_IFJ_WIDGET" SET "SYNC_PERIOD_CRON" = '<CRON_EXPRESSION>'  WHERE "SYNC_PERIOD" = 'ADVANCED' AND "ID" = REPORT_ID;
        

        - Replace <CRON_EXPRESSION> with the CRON_EXPRESSION without blank space. Make sure that the CRON expression is valid.
        - Replace <REPORT_ID> with the affected Asset report ID.

        1. image-2024-07-19-14-11-27-692.png
          42 kB
          Rodrigo Jose Zaparoli
        2. image-2024-07-19-14-12-04-780.png
          29 kB
          Rodrigo Jose Zaparoli
        3. image-2024-07-19-14-39-27-475.png
          83 kB
          Rodrigo Jose Zaparoli
        4. JSDSERVER-15459 - Reproducing the issue.mov
          5.08 MB
          Rodrigo Jose Zaparoli

            [JSDSERVER-15459] Adding a blank space in front of the CRON expression in one Assets Report will make the entire Assets Reports page fail to load

            Jira Server Release Automation Bot[ADM-107524] made changes -
            Fix Version/s Original: 5.12.22 [ 111192 ]
            Fix Version/s New: 5.12.23 [ 112309 ]
            Jira Server Release Automation Bot[ADM-107524] made changes -
            Fix Version/s Original: 5.12.21 [ 111190 ]
            Fix Version/s New: 5.12.22 [ 111192 ]
            Tripta Kaur made changes -
            Fix Version/s New: 10.3.6 [ 111290 ]
            Fix Version/s New: 5.12.21 [ 111190 ]
            Nikhil Janardhanan made changes -
            Affects Version/s New: 5.12.19 [ 110205 ]
            Nikhil Janardhanan made changes -
            Remote Link New: This issue links to "Page (Atlassian Documentation)" [ 1001480 ]
            Tripta Kaur made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: In Progress [ 3 ] New: Closed [ 6 ]
            Tripta Kaur made changes -
            Fix Version/s New: 10.2.0 [ 109023 ]
            Tripta Kaur made changes -
            Status Original: Short Term Backlog [ 12074 ] New: In Progress [ 3 ]
            Tripta Kaur made changes -
            Assignee New: Tripta Kaur [ 399904f8a539 ]
            Marc Dacanay made changes -
            Labels Original: ltsr New: lts10nth

              399904f8a539 Tripta Kaur
              7d74d3b1a350 Rodrigo Jose Zaparoli
              Affected customers:
              0 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: