SamahSohrab607228

Java API - index out of bounds error on simple call

Discussion created by SamahSohrab607228 on Mar 23, 2018
Latest reply on Mar 24, 2018 by SamahSohrab607228
I'm having a strange issue with the Java API calling to get JobHeaders. 
Here is my code
OpenObject openObject = new OpenObject(new UC4ObjectName(jobName), true, true)
connectionService.sendRequestAndWait(openObject)
UC4Object uc4_object = openObject.getUC4Object()

connectionService.sendRequestAndWait(new CloseObject(uc4_object))

and here is my stack trace
java.lang.IndexOutOfBoundsException: Index: 12, Size: 4
        at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        at java.util.ArrayList.get(ArrayList.java:433)
        at com.uc4.api.objects.WorkflowTasks.getTask(WorkflowTasks.java:97)
        at com.uc4.api.objects.WorkflowTasks.<init>(WorkflowTasks.java:66)
        at com.uc4.api.objects.JobPlan.loadContent(JobPlan.java:43)
        at com.uc4.api.objects.UC4Object.load(UC4Object.java:166)
        at com.uc4.communication.requests.OpenObject.handleContent(OpenObject.java:179)
        at com.uc4.communication.requests.XMLRequest.handleResponse(XMLRequest.java:75)
        at com.uc4.communication.Connection.sendRequestAndWait(Connection.java:1180)

This function works for hundreds/thousands of other jobs/workflows, but this workflow is giving this error. The header tab is valid when you open it via the client, and the workflow is running without issue.

Outcomes