TWS Java API editAddJobStreamInstanceWithVariableSubstitution

109 views Asked by At

I am trying to edit and add job stream to the CP, but one more time I am getting "java.lang.NullPointerException" without any additional information.

List<ZosJobInfo> jobsToAdd = new ArrayList<>();
ZosJobInfo zosJobInfo = new ZosJobInfo();
zosJobInfo.setJobName("DMSORT");
zosJobInfo.setJobNumber(5);
zosJobInfo.setTimeDependent(false);
zosJobInfo.setWorkstationName("CPU1");
zosJobInfo.setWorkstationType(WorkstationType.COMPUTER);
zosJobInfo.setAutoSubmit(true);
zosJobInfo.setTaskType(TaskTypes.ZOS_JOB_TASK);
zosJobInfo.setDuration(1000L);
zosJobInfo.setCentralizedScript(false);
zosJobInfo.setParallelServer(1);
zosJobInfo.setR1(1);
zosJobInfo.setR2(1);
jobsToAdd.add(zosJobInfo);
HashMap<String, List<Integer>> dependencies = new HashMap<>();
List<Integer> jobPred = new ArrayList<>();
jobPred.add(1);
dependencies.put("5", jobPred);
DateTimeFormatter formatter2 = DateTimeFormat.forPattern("dd-MM-yyyy HH:mm z");
DateTime dateTime2 = DateTime.parse("14-05-2018 10:27 GMT",formatter2);
DateTime dlt = dateTime2.plusMinutes(1);
plan.editAddJobStreamInstanceWithVariableSubstitution(tempJobStream.getName(), dateTime2.toDate(), dlt.toDate(), 5, "EDIT ADD", "", "OWNER", "", "", null, jobsToAdd, null, null, dependencies, null, "", false,DependenciesResolutionOption.RESOLUTION_NONE, null, null);
1

There are 1 answers

2
Davide Canalis On

Fill the "variables to be substituted" field with a void variable (it's a String[][] field). This should be sufficient to avoid null pointer exception.