Uploaded image for project: 'JBeret'
  1. JBeret
  2. JBERET-191

JdbcRepository uses the wrong jobInstanceId when getting all job executions with null job instance

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.3.0.Alpha1
    • 1.2.0.Final
    • jberet-core
    • None

      when getting all job executions while passing null job instance, JdbcRepository uses the wrong job instance id to retrieve job instance, and hence the wrong job instance is set to the job executions.

      This issue only occurs when passing null job instance to getJobExecutions(JobInstance) method. Also need to check other types of repository and see if the same issue exists.

      around line 572:

      if (jobInstanceId == 0) {
         jobInstanceId = rs.getLong(TableColumns.JOBINSTANCEID);
      }
      

      jobInstanceId variable is inside a loop, and its value from previous iteration will carry over to the next, and since it's already non-zero, it will skip the above check and is incorrectly used in the new iteration.

      A similar issue:
      https://github.com/jberet/jsr352/issues/81

              cfang@redhat.com Cheng Fang
              cfang@redhat.com Cheng Fang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: