Program: 14951
Project: 14951
Buggy source:
private String getNetworkTopology(){
  if (topoString.get() != null && (lastTime + (1 * 1000l)) > System.currentTimeMillis()) {
    return topoString.get();
  }
 else {
    lock.lock();
    try {
      if (topoString.get() != null && (lastTime + (1 * 1000l)) > System.currentTimeMillis()) {
        return topoString.get();
      }
 else {
        lastTime=System.currentTimeMillis();
        StringBuilder buf=new StringBuilder();
        Multimap<String,String> networks=ArrayListMultimap.create();
        Multimap<String,String> rules=ArrayListMultimap.create();
        EntityTransaction tx=Entities.get(VmInstance.class);
        try {
          for (          VmInstance vm : VmInstances.listValues()) {
            if (VmState.RUNNING.ordinal() < vm.getState().ordinal())             continue;
            for (            NetworkGroup ruleGroup : vm.getNetworkRulesGroups()) {
              networks.put(ruleGroup.getNaturalId(),vm.getPrivateAddress());
              if (!rules.containsKey(ruleGroup.getNaturalId())) {
                for (                NetworkRule netRule : ruleGroup.getNetworkRules()) {
                  String rule=String.format("String_Node_Str",netRule.getProtocol(),("String_Node_Str".equals(netRule.getProtocol()) ? "String_Node_Str" : "String_Node_Str"),netRule.getLowPort(),("String_Node_Str".equals(netRule.getProtocol()) ? "String_Node_Str" : "String_Node_Str"),netRule.getHighPort());
                  for (                  NetworkPeer peer : netRule.getNetworkPeers()) {
                    rules.put(ruleGroup.getName(),String.format("String_Node_Str",rule,peer.getGroupName(),peer.getUserQueryKey()));
                  }
                  for (                  IpRange cidr : netRule.getIpRanges()) {
                    rules.put(ruleGroup.getName(),String.format("String_Node_Str",rule,cidr.getValue()));
                  }
                }
              }
            }
          }
          for (          String networkName : rules.keySet()) {
            for (            String rule : rules.get(networkName)) {
              buf.append("String_Node_Str").append(networkName).append("String_Node_Str").append(rule).append("String_Node_Str");
            }
          }
          for (          String networkName : networks.keySet()) {
            buf.append("String_Node_Str").append(networkName);
            for (            String ip : networks.get(networkName)) {
              buf.append("String_Node_Str").append(ip);
            }
            buf.append("String_Node_Str");
          }
        }
  finally {
          tx.rollback();
        }
        topoString.set(buf.toString());
      }
      return topoString.get();
    }
  finally {
      lock.unlock();
    }
  }
}

Fixed version (ground truth):
private String getNetworkTopology(){
  if (topoString.get() != null && (lastTime + (1 * 1000l)) > System.currentTimeMillis()) {
    return topoString.get();
  }
 else {
    lock.lock();
    try {
      if (topoString.get() != null && (lastTime + (1 * 1000l)) > System.currentTimeMillis()) {
        return topoString.get();
      }
 else {
        lastTime=System.currentTimeMillis();
        StringBuilder buf=generateTopology();
        topoString.set(buf.toString());
      }
      return topoString.get();
    }
  finally {
      lock.unlock();
    }
  }
}