if (parent == null) {  logger.error("CANNOT CREATE MILTASK, no parent, inventory: " + getAssetUtils().assetDesc(inventory.getScheduledContentPG().getAsset())); return null;
if (parent == null || parent.getPlanElement() == null) {  if (logger.isWarnEnabled()) { logger.warn("CANNOT CREATE MILTASK, no parent, parent pe or inventory: " + getAssetUtils().assetDesc(inventory.getScheduledContentPG().getAsset()) + " PARENT TASK IS: " + parent + " PARENT PE IS: " + parent.getPlanElement()); } return null;
  public Task findOrMakeMILTask(Inventory inventory, CollectionSubscription aggMILSubscription) {    // Creates the MaintainInventoryLevels Task for this item     // if one does not already exist    NewTask milTask = (NewTask) MILTaskHash.get(inventory);    if (milTask == null) {      Task parent = getDetermineRequirementsTask(aggMILSubscription);      if (parent == null) {	/**	   This might happen just after the last determine	   requirements task is removed. Because of inertia,	   the inventory manager might still be trying to	   refill the inventory although, in fact the demand	   for that inventory is in the process of	   disappearing. The caller, getting a null return will	   simply abandon the attempt to do the refill.	**/	logger.error("CANNOT CREATE MILTASK, no parent, inventory: "		     + getAssetUtils().assetDesc(inventory.getScheduledContentPG().getAsset()));		return null; // Can't make one      }      milTask = createMILTask(parent, inventory);      PlanElement pe = parent.getPlanElement();      if (pe instanceof Expansion) {        Expansion expansion =(Expansion)pe;        NewWorkflow wf = (NewWorkflow)expansion.getWorkflow();        wf.addTask(milTask);        ((NewTask) milTask).setWorkflow(wf);        inventoryPlugin.publishChange(expansion);      } else {        logger.error("publish Change to MIL Top Expansion: problem pe not Expansion? "+pe);      }      // Publish new task      if (!inventoryPlugin.publishAdd(milTask)) {        logger.error("publishAdd(milTask) fail to publish task "+ getTaskUtils().taskDesc(milTask));      }      MILTaskHash.put(inventory, milTask);    }    return milTask;  }