Program: 7362
Project: 7362
Buggy source:
/** 
 * Create a new aggregator for the   {@code streamName}, and add it to the existing map of   {@link Cancellable}{@code aggregators}. This method does not cancel previously existing aggregator associated to the  {@code streamName}.
 * @param streamName stream name to create a new aggregator for
 * @param baseCount stream size from which to start aggregating
 * @return the created {@link StreamSizeAggregator}
 */
private StreamSizeAggregator createSizeAggregator(String streamName,long baseCount,final int threshold){
  final Cancellable thresholdSubscription=getStreamCoordinatorClient().addListener(streamName,new StreamPropertyListener(){
    @Override public void thresholdChanged(    String streamName,    int threshold){
      StreamSizeAggregator aggregator=aggregators.get(streamName);
      if (aggregator == null) {
        LOG.warn("String_Node_Str",streamName);
        return;
      }
      aggregator.setStreamThresholdMB(threshold);
    }
  }
);
  final Cancellable truncationSubscription=getStreamCoordinatorClient().addListener(streamName,new StreamPropertyListener(){
    @Override public void generationChanged(    String streamName,    int generation){
      Cancellable previousAggregator=aggregators.replace(streamName,createSizeAggregator(streamName,0,threshold));
      if (previousAggregator != null) {
        previousAggregator.cancel();
      }
    }
  }
);
  StreamSizeAggregator newAggregator=new StreamSizeAggregator(streamName,baseCount,threshold,new Cancellable(){
    @Override public void cancel(){
      thresholdSubscription.cancel();
      truncationSubscription.cancel();
    }
  }
);
  aggregators.put(streamName,newAggregator);
  return newAggregator;
}

Fixed version (ground truth):
/** 
 * Create a new aggregator for the   {@code streamName}, and add it to the existing map of   {@link Cancellable}{@code aggregators}. This method does not cancel previously existing aggregator associated to the  {@code streamName}.
 * @param streamName stream name to create a new aggregator for
 * @param baseCount stream size from which to start aggregating
 * @return the created {@link StreamSizeAggregator}
 */
private StreamSizeAggregator createSizeAggregator(String streamName,long baseCount,final int threshold){
  LOG.debug("String_Node_Str",streamName);
  final Cancellable thresholdSubscription=getStreamCoordinatorClient().addListener(streamName,new StreamPropertyListener(){
    @Override public void thresholdChanged(    String streamName,    int threshold){
      StreamSizeAggregator aggregator=aggregators.get(streamName);
      if (aggregator == null) {
        LOG.warn("String_Node_Str",streamName);
        return;
      }
      aggregator.setStreamThresholdMB(threshold);
    }
  }
);
  final Cancellable truncationSubscription=getStreamCoordinatorClient().addListener(streamName,new StreamPropertyListener(){
    @Override public void generationChanged(    String streamName,    int generation){
      int currentThresold=threshold;
      StreamSizeAggregator currentAggregator=aggregators.get(streamName);
      if (currentAggregator != null) {
        currentThresold=currentAggregator.getStreamThresholdMB();
      }
      Cancellable previousAggregator=aggregators.replace(streamName,createSizeAggregator(streamName,0,currentThresold));
      if (previousAggregator != null) {
        previousAggregator.cancel();
      }
    }
  }
);
  StreamSizeAggregator newAggregator=new StreamSizeAggregator(streamName,baseCount,threshold,new Cancellable(){
    @Override public void cancel(){
      thresholdSubscription.cancel();
      truncationSubscription.cancel();
    }
  }
);
  aggregators.put(streamName,newAggregator);
  return newAggregator;
}