Program: 132163
Project: 132163
Buggy source:
/** 
 * Create a Rendered Path and all the associated operational state based on the given rendered service path <p>
 * @param serviceFunctionPath RSP Object
 * @return Nothing.
 */
protected RenderedServicePath createRenderedServicePathEntry(ServiceFunctionPath serviceFunctionPath,CreateRenderedPathInput createRenderedPathInput){
  printTraceStart(LOG);
  long pathId;
  int serviceIndex;
  RenderedServicePath ret=null;
  ServiceFunctionChain serviceFunctionChain;
  String serviceFunctionChainName=serviceFunctionPath.getServiceChainName();
  serviceFunctionChain=serviceFunctionChainName != null ? SfcProviderServiceChainAPI.readServiceFunctionChain(serviceFunctionChainName) : null;
  if (serviceFunctionChain == null) {
    LOG.error("String_Node_Str",serviceFunctionPath.getName());
    return ret;
  }
  RenderedServicePathBuilder renderedServicePathBuilder=new RenderedServicePathBuilder();
  serviceIndex=MAX_STARTING_INDEX;
  List<String> sfNameList=scheduler.scheduleServiceFuntions(serviceFunctionChain,serviceIndex);
  if (sfNameList == null) {
    LOG.warn("String_Node_Str");
    return null;
  }
  List<RenderedServicePathHop> renderedServicePathHopArrayList=createRenderedServicePathHopList(sfNameList,serviceIndex);
  if (renderedServicePathHopArrayList == null) {
    LOG.warn("String_Node_Str");
    return null;
  }
  pathId=(serviceFunctionPath.getPathId() != null) ? serviceFunctionPath.getPathId() : numCreatedPathIncrementGet();
  renderedServicePathBuilder.setRenderedServicePathHop(renderedServicePathHopArrayList);
  if (createRenderedPathInput.getName() == null || createRenderedPathInput.getName().isEmpty()) {
    renderedServicePathBuilder.setName(serviceFunctionChainName + "String_Node_Str" + pathId);
  }
 else {
    renderedServicePathBuilder.setName(createRenderedPathInput.getName());
  }
  renderedServicePathBuilder.setPathId(pathId);
  renderedServicePathBuilder.setStartingIndex((short)MAX_STARTING_INDEX);
  renderedServicePathBuilder.setServiceChainName(serviceFunctionChainName);
  renderedServicePathBuilder.setParentServiceFunctionPath(serviceFunctionPath.getName());
  RenderedServicePathKey renderedServicePathKey=new RenderedServicePathKey(renderedServicePathBuilder.getName());
  InstanceIdentifier<RenderedServicePath> rspIID;
  rspIID=InstanceIdentifier.builder(RenderedServicePaths.class).child(RenderedServicePath.class,renderedServicePathKey).build();
  RenderedServicePath renderedServicePath=renderedServicePathBuilder.build();
  if (SfcDataStoreAPI.writeMergeTransactionAPI(rspIID,renderedServicePath,LogicalDatastoreType.OPERATIONAL)) {
    ret=renderedServicePath;
  }
 else {
    LOG.error("String_Node_Str",Thread.currentThread().getStackTrace()[1],serviceFunctionPath.getName());
  }
  printTraceStop(LOG);
  return ret;
}

Fixed version (ground truth):
/** 
 * Create a Rendered Path and all the associated operational state based on the given rendered service path <p>
 * @param serviceFunctionPath RSP Object
 * @return Nothing.
 */
protected RenderedServicePath createRenderedServicePathEntry(ServiceFunctionPath serviceFunctionPath,CreateRenderedPathInput createRenderedPathInput){
  printTraceStart(LOG);
  long pathId;
  int serviceIndex;
  RenderedServicePath ret=null;
  ServiceFunctionChain serviceFunctionChain;
  String serviceFunctionChainName=serviceFunctionPath.getServiceChainName();
  serviceFunctionChain=serviceFunctionChainName != null ? SfcProviderServiceChainAPI.readServiceFunctionChain(serviceFunctionChainName) : null;
  if (serviceFunctionChain == null) {
    LOG.error("String_Node_Str",serviceFunctionPath.getName());
    return ret;
  }
  RenderedServicePathBuilder renderedServicePathBuilder=new RenderedServicePathBuilder();
  serviceIndex=MAX_STARTING_INDEX;
  List<String> sfNameList=scheduler.scheduleServiceFuntions(serviceFunctionChain,serviceIndex);
  if (sfNameList == null) {
    LOG.warn("String_Node_Str");
    return null;
  }
  List<RenderedServicePathHop> renderedServicePathHopArrayList=createRenderedServicePathHopList(sfNameList,serviceIndex);
  if (renderedServicePathHopArrayList == null) {
    LOG.warn("String_Node_Str");
    return null;
  }
  pathId=(serviceFunctionPath.getPathId() != null) ? serviceFunctionPath.getPathId() : numCreatedPathIncrementGet();
  renderedServicePathBuilder.setRenderedServicePathHop(renderedServicePathHopArrayList);
  if (createRenderedPathInput.getName() == null || createRenderedPathInput.getName().isEmpty()) {
    renderedServicePathBuilder.setName(serviceFunctionPath.getName() + "String_Node_Str" + pathId);
  }
 else {
    renderedServicePathBuilder.setName(createRenderedPathInput.getName());
  }
  renderedServicePathBuilder.setPathId(pathId);
  renderedServicePathBuilder.setStartingIndex((short)MAX_STARTING_INDEX);
  renderedServicePathBuilder.setServiceChainName(serviceFunctionChainName);
  renderedServicePathBuilder.setParentServiceFunctionPath(serviceFunctionPath.getName());
  RenderedServicePathKey renderedServicePathKey=new RenderedServicePathKey(renderedServicePathBuilder.getName());
  InstanceIdentifier<RenderedServicePath> rspIID;
  rspIID=InstanceIdentifier.builder(RenderedServicePaths.class).child(RenderedServicePath.class,renderedServicePathKey).build();
  RenderedServicePath renderedServicePath=renderedServicePathBuilder.build();
  if (SfcDataStoreAPI.writeMergeTransactionAPI(rspIID,renderedServicePath,LogicalDatastoreType.OPERATIONAL)) {
    ret=renderedServicePath;
  }
 else {
    LOG.error("String_Node_Str",Thread.currentThread().getStackTrace()[1],serviceFunctionPath.getName());
  }
  printTraceStop(LOG);
  return ret;
}