Program: 15427
Project: 15427
Buggy source:
public void fireEvent(Event e){
  final long receivedEventMs=this.getCurrentTimeMillis();
  if (e instanceof InstanceEvent) {
    log.info("String_Node_Str");
    InstanceEvent event=(InstanceEvent)e;
    final String uuid=event.getUuid();
    EntityWrapper<InstanceAttributes> entityWrapper=EntityWrapper.get(InstanceAttributes.class);
    try {
      InstanceAttributes insAttrs=new InstanceAttributes(uuid,event.getInstanceId(),event.getInstanceType(),event.getUserId(),event.getAccountId(),event.getClusterName(),event.getAvailabilityZone());
      InstanceUsageSnapshot insUsageSnapshot=new InstanceUsageSnapshot(uuid,receivedEventMs,event.getCumulativeNetworkIoMegs(),event.getCumulativeDiskIoMegs());
      if (!recentlySeenUuids.contains(uuid)) {
        try {
          entityWrapper.getUnique(new InstanceAttributes(){
{
              setUuid(uuid);
            }
          }
);
        }
 catch (        Exception ex) {
          entityWrapper.add(insAttrs);
          log.info("String_Node_Str" + uuid);
        }
        recentlySeenUuids.add(uuid);
      }
      recentUsageSnapshots.add(insUsageSnapshot);
      if (receivedEventMs > (lastWriteMs + getWriteIntervalMs())) {
        for (        InstanceUsageSnapshot ius : recentUsageSnapshots) {
          entityWrapper.recast(InstanceUsageSnapshot.class).add(ius);
          log.info("String_Node_Str" + ius.getUuid() + "String_Node_Str"+ ius.getEntityId());
        }
        recentUsageSnapshots.clear();
        lastWriteMs=receivedEventMs;
      }
      entityWrapper.commit();
    }
 catch (    Exception ex) {
      entityWrapper.rollback();
      log.error(ex);
    }
  }
}

Fixed version (ground truth):
public void fireEvent(Event e){
  final long receivedEventMs=this.getCurrentTimeMillis();
  if (e instanceof InstanceEvent) {
    log.info("String_Node_Str");
    InstanceEvent event=(InstanceEvent)e;
    final String uuid=event.getUuid();
    EntityWrapper<InstanceAttributes> entityWrapper=EntityWrapper.get(InstanceAttributes.class);
    try {
      InstanceAttributes insAttrs=new InstanceAttributes(uuid,event.getInstanceId(),event.getInstanceType(),event.getUserId(),event.getAccountId(),event.getClusterName(),event.getAvailabilityZone());
      InstanceUsageSnapshot insUsageSnapshot=new InstanceUsageSnapshot(uuid,receivedEventMs,event.getCumulativeNetworkIoMegs(),event.getCumulativeDiskIoMegs());
      if (!recentlySeenUuids.contains(uuid)) {
        try {
          entityWrapper.getUnique(new InstanceAttributes(){
{
              setUuid(uuid);
            }
          }
);
        }
 catch (        Exception ex) {
          entityWrapper.add(insAttrs);
          log.info("String_Node_Str" + uuid);
        }
        recentlySeenUuids.add(uuid);
      }
      if (!recentUsageSnapshots.containsKey(uuid)) {
        recentUsageSnapshots.put(uuid,insUsageSnapshot);
      }
 else {
        InstanceUsageSnapshot oldSnapshot=recentUsageSnapshots.get(uuid);
        if (oldSnapshot.getTimestampMs() < insUsageSnapshot.getTimestampMs()) {
          recentUsageSnapshots.put(uuid,insUsageSnapshot);
        }
 else {
          log.error("String_Node_Str");
        }
      }
      log.info("String_Node_Str");
      if (receivedEventMs > (lastWriteMs + getWriteIntervalMs())) {
        for (        String key : recentUsageSnapshots.keySet()) {
          log.info("String_Node_Str" + uuid);
          InstanceUsageSnapshot ius=recentUsageSnapshots.get(key);
          entityWrapper.recast(InstanceUsageSnapshot.class).add(ius);
          log.info("String_Node_Str" + ius.getUuid() + "String_Node_Str"+ ius.getEntityId());
        }
        recentUsageSnapshots.clear();
        lastWriteMs=receivedEventMs;
      }
      entityWrapper.commit();
    }
 catch (    Exception ex) {
      entityWrapper.rollback();
      log.error(ex);
    }
  }
}