#vulnerable code 
                             void processWorkList(ItemCollection activityEntity) throws Exception {
		// get processID
		int iProcessID = activityEntity.getItemValueInteger("numprocessid");
		// get Modelversion
		String sModelVersion = activityEntity
				.getItemValueString("$modelversion");

		// if a query is defined in the activityEntity then use the EQL
		// statement
		// to query the items. Otherwise use standard method
		// getWorklistByProcessID()
		String sQuery = activityEntity.getItemValueString("txtscheduledview");

		// get all workitems...
		Collection<ItemCollection> worklist = null;
		if (sQuery != null && !"".equals(sQuery)) {
			logger.fine("[WorkflowSchedulerService] Query=" + sQuery);
			worklist = entityService.findAllEntities(sQuery, 0, -1);
		} else {
			logger.fine("[WorkflowSchedulerService] get WorkList for ProcessID:"
					+ iProcessID);
			worklist = workflowService.getWorkListByProcessID(iProcessID, 0,
					-1, null, 0);
		}
		logger.fine("[WorkflowSchedulerService] " + worklist.size()
				+ " workitems found");
		iScheduledWorkItems += worklist.size();
		for (ItemCollection workitem : worklist) {
			// verify processID
			if (iProcessID == workitem.getItemValueInteger("$processid")) {
				// verify modelversion
				if (sModelVersion.equals(workitem
						.getItemValueString("$modelversion"))) {
					// verify due date
					if (workItemInDue(workitem, activityEntity)) {

						int iActivityID = activityEntity
								.getItemValueInteger("numActivityID");
						workitem.replaceItemValue("$activityid", iActivityID);
						processWorkitem(workitem);
						iProcessWorkItems++;

					}
				}
			}
		}
	} 
                            #location 32 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             Timer createTimerOnInterval(ItemCollection configItemCollection) {

		// Create an interval timer
		Date startDate = configItemCollection.getItemValueDate("datstart");
		Date endDate = configItemCollection.getItemValueDate("datstop");
		long interval = configItemCollection.getItemValueInteger("numInterval");
		// if endDate is in the past we do not start the timer!
		Calendar calNow = Calendar.getInstance();
		Calendar calEnd = Calendar.getInstance();

		if (endDate != null)
			calEnd.setTime(endDate);
		if (calNow.after(calEnd)) {
			logger.warning("[WorkflowSchedulerService] "
					+ configItemCollection.getItemValueString("txtName")
					+ " stop-date is in the past");

			endDate = startDate;
		}
		Timer timer = timerService.createTimer(startDate, interval,
				configItemCollection);

		return timer;

	}