Program: 135817
Project: 135817
Buggy source:
/** 
 * Read the Inventory data tree to find information about the Nodes & NodeConnectors. Create the list of NodeConnectors for a given switch.  Also determine the STP status of each NodeConnector.
 */
public void readInventory(){
  if (!refreshData) {
    return;
  }
synchronized (this) {
    if (!refreshData)     return;
    InstanceIdentifier.InstanceIdentifierBuilder<Nodes> nodesInsIdBuilder=InstanceIdentifier.<Nodes>builder(Nodes.class);
    Nodes nodes=null;
    ReadOnlyTransaction readOnlyTransaction=dataService.newReadOnlyTransaction();
    try {
      Optional<Nodes> dataObjectOptional=null;
      dataObjectOptional=readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL,nodesInsIdBuilder.build()).get();
      if (dataObjectOptional.isPresent())       nodes=(Nodes)dataObjectOptional.get();
    }
 catch (    InterruptedException e) {
      _logger.error("String_Node_Str");
      readOnlyTransaction.close();
      throw new RuntimeException("String_Node_Str",e);
    }
catch (    ExecutionException e) {
      _logger.error("String_Node_Str");
      readOnlyTransaction.close();
      throw new RuntimeException("String_Node_Str",e);
    }
    if (nodes != null) {
      for (      Node node : nodes.getNode()) {
        ArrayList<NodeConnectorRef> nodeConnectorRefs=new ArrayList<NodeConnectorRef>();
        List<NodeConnector> nodeConnectors=node.getNodeConnector();
        if (nodeConnectors != null) {
          for (          NodeConnector nodeConnector : nodeConnectors) {
            StpStatusAwareNodeConnector saNodeConnector=nodeConnector.getAugmentation(StpStatusAwareNodeConnector.class);
            if (saNodeConnector != null && StpStatus.Discarding.equals(saNodeConnector.getStatus())) {
              continue;
            }
            if (nodeConnector.getKey().toString().contains("String_Node_Str")) {
              continue;
            }
            NodeConnectorRef ncRef=new NodeConnectorRef(InstanceIdentifier.<Nodes>builder(Nodes.class).<Node,NodeKey>child(Node.class,node.getKey()).<NodeConnector,NodeConnectorKey>child(NodeConnector.class,nodeConnector.getKey()).build());
            nodeConnectorRefs.add(ncRef);
          }
        }
        switchNodeConnectors.put(node.getId().getValue(),nodeConnectorRefs);
        NodeConnectorRef ncRef=new NodeConnectorRef(InstanceIdentifier.<Nodes>builder(Nodes.class).<Node,NodeKey>child(Node.class,node.getKey()).<NodeConnector,NodeConnectorKey>child(NodeConnector.class,new NodeConnectorKey(new NodeConnectorId(node.getId().getValue() + "String_Node_Str"))).build());
        _logger.debug("String_Node_Str",node.getKey(),ncRef);
        controllerSwitchConnectors.put(node.getId().getValue(),ncRef);
      }
    }
    readOnlyTransaction.close();
    refreshData=false;
  }
}

Fixed version (ground truth):
/** 
 * Read the Inventory data tree to find information about the Nodes and NodeConnectors. Create the list of NodeConnectors for a given switch.  Also determine the STP status of each NodeConnector.
 */
public void readInventory(){
  if (!refreshData) {
    return;
  }
synchronized (this) {
    if (!refreshData)     return;
    InstanceIdentifier.InstanceIdentifierBuilder<Nodes> nodesInsIdBuilder=InstanceIdentifier.<Nodes>builder(Nodes.class);
    Nodes nodes=null;
    ReadOnlyTransaction readOnlyTransaction=dataService.newReadOnlyTransaction();
    try {
      Optional<Nodes> dataObjectOptional=null;
      dataObjectOptional=readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL,nodesInsIdBuilder.build()).get();
      if (dataObjectOptional.isPresent())       nodes=(Nodes)dataObjectOptional.get();
    }
 catch (    InterruptedException e) {
      _logger.error("String_Node_Str");
      readOnlyTransaction.close();
      throw new RuntimeException("String_Node_Str",e);
    }
catch (    ExecutionException e) {
      _logger.error("String_Node_Str");
      readOnlyTransaction.close();
      throw new RuntimeException("String_Node_Str",e);
    }
    if (nodes != null) {
      for (      Node node : nodes.getNode()) {
        ArrayList<NodeConnectorRef> nodeConnectorRefs=new ArrayList<NodeConnectorRef>();
        List<NodeConnector> nodeConnectors=node.getNodeConnector();
        if (nodeConnectors != null) {
          for (          NodeConnector nodeConnector : nodeConnectors) {
            StpStatusAwareNodeConnector saNodeConnector=nodeConnector.getAugmentation(StpStatusAwareNodeConnector.class);
            if (saNodeConnector != null && StpStatus.Discarding.equals(saNodeConnector.getStatus())) {
              continue;
            }
            if (nodeConnector.getKey().toString().contains("String_Node_Str")) {
              continue;
            }
            NodeConnectorRef ncRef=new NodeConnectorRef(InstanceIdentifier.<Nodes>builder(Nodes.class).<Node,NodeKey>child(Node.class,node.getKey()).<NodeConnector,NodeConnectorKey>child(NodeConnector.class,nodeConnector.getKey()).build());
            nodeConnectorRefs.add(ncRef);
          }
        }
        switchNodeConnectors.put(node.getId().getValue(),nodeConnectorRefs);
        NodeConnectorRef ncRef=new NodeConnectorRef(InstanceIdentifier.<Nodes>builder(Nodes.class).<Node,NodeKey>child(Node.class,node.getKey()).<NodeConnector,NodeConnectorKey>child(NodeConnector.class,new NodeConnectorKey(new NodeConnectorId(node.getId().getValue() + "String_Node_Str"))).build());
        _logger.debug("String_Node_Str",node.getKey(),ncRef);
        controllerSwitchConnectors.put(node.getId().getValue(),ncRef);
      }
    }
    readOnlyTransaction.close();
    refreshData=false;
  }
}