Program: 109558
Project: 109558
Buggy source:
@Override public void perform(Rewrite rewrite,EvaluationContext context){
  if (!(rewrite instanceof GraphRewrite))   throw new IllegalArgumentException("String_Node_Str");
  GraphRewrite event=(GraphRewrite)rewrite;
  List<Rule> rules=config.getRules();
  for (  RuleLifecycleListener listener : listeners) {
    listener.beforeExecution();
  }
  final EvaluationContextImpl subContext=new EvaluationContextImpl();
  for (int i=0; i < rules.size(); i++) {
    Rule rule=rules.get(i);
    Context ruleContext=rule instanceof Context ? (Context)rule : null;
    long ruleTimeStarted=System.currentTimeMillis();
    try {
      subContext.clear();
      subContext.put(ParameterStore.class,context.get(ParameterStore.class));
      ParameterValueStore values=(ParameterValueStore)context.get(ParameterValueStore.class);
      subContext.put(ParameterValueStore.class,values);
      subContext.setState(RewriteState.EVALUATING);
      subContext.put(Rule.class,rule);
      event.selectionPush();
      try {
        for (        RuleLifecycleListener listener : listeners) {
          listener.beforeRuleEvaluation(rule,subContext);
        }
        if (rule.evaluate(event,subContext)) {
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleConditionEvaluation(event,subContext,rule,true);
          }
          if (!handleBindings(event,subContext,values))           continue;
          subContext.setState(RewriteState.PERFORMING);
          final Object ruleProviderDesc=((RuleBuilder)rule).get(RuleMetadata.RULE_PROVIDER);
          log.info("String_Node_Str" + ruleProviderDesc + "String_Node_Str");
          for (          RuleLifecycleListener listener : listeners) {
            listener.beforeRuleOperationsPerformed(event,subContext,rule);
          }
          List<Operation> preOperations=subContext.getPreOperations();
          for (          Operation preOperation : preOperations) {
            preOperation.perform(event,subContext);
          }
          if (event.getFlow().isHandled())           break;
          rule.perform(event,subContext);
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleOperationsPerformed(event,subContext,rule);
          }
          if (event.getFlow().isHandled())           break;
          List<Operation> postOperations=subContext.getPostOperations();
          for (          Operation postOperation : postOperations) {
            postOperation.perform(event,subContext);
          }
          if (event.getFlow().isHandled())           break;
        }
 else {
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleConditionEvaluation(event,subContext,rule,false);
          }
        }
      }
  finally {
        boolean autocommit=true;
        if (ruleContext != null && ruleContext.containsKey(RuleMetadata.AUTO_COMMIT)) {
          autocommit=(Boolean)ruleContext.get(RuleMetadata.AUTO_COMMIT);
        }
        if (autocommit) {
          event.getGraphContext().getGraph().getBaseGraph().commit();
        }
        event.selectionPop();
        long ruleTimeCompleted=System.currentTimeMillis();
        if (ruleContext != null) {
          int timeTaken=(int)(ruleTimeCompleted - ruleTimeStarted);
          logTimeTakenByRuleProvider(event.getGraphContext(),ruleContext,i,timeTaken);
        }
      }
    }
 catch (    RuntimeException ex) {
      String message="String_Node_Str" + rule;
      message="String_Node_Str" + ex.getMessage();
      if (ruleContext != null) {
        Object origin=ruleContext.get(RuleMetadata.ORIGIN);
        if (origin != null)         message+="String_Node_Str" + origin;
        Object location=ruleContext.get(org.ocpsoft.rewrite.config.RuleMetadata.PROVIDER_LOCATION);
        if (location != null)         message+="String_Node_Str" + location;
      }
      throw new WindupException(message,ex);
    }
  }
  for (  RuleLifecycleListener listener : listeners) {
    listener.afterExecution();
  }
}

Fixed version (ground truth):
@Override public void perform(Rewrite rewrite,EvaluationContext context){
  if (!(rewrite instanceof GraphRewrite))   throw new IllegalArgumentException("String_Node_Str");
  GraphRewrite event=(GraphRewrite)rewrite;
  List<Rule> rules=config.getRules();
  for (  RuleLifecycleListener listener : listeners) {
    listener.beforeExecution();
  }
  final EvaluationContextImpl subContext=new EvaluationContextImpl();
  for (int i=0; i < rules.size(); i++) {
    Rule rule=rules.get(i);
    Context ruleContext=rule instanceof Context ? (Context)rule : null;
    long ruleTimeStarted=System.currentTimeMillis();
    try {
      subContext.clear();
      subContext.put(ParameterStore.class,context.get(ParameterStore.class));
      ParameterValueStore values=(ParameterValueStore)context.get(ParameterValueStore.class);
      subContext.put(ParameterValueStore.class,values);
      subContext.setState(RewriteState.EVALUATING);
      subContext.put(Rule.class,rule);
      event.selectionPush();
      try {
        for (        RuleLifecycleListener listener : listeners) {
          listener.beforeRuleEvaluation(rule,subContext);
        }
        if (rule.evaluate(event,subContext)) {
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleConditionEvaluation(event,subContext,rule,true);
          }
          if (!handleBindings(event,subContext,values))           continue;
          subContext.setState(RewriteState.PERFORMING);
          final Object ruleProviderDesc=((RuleBuilder)rule).get(RuleMetadata.RULE_PROVIDER);
          log.info("String_Node_Str" + ruleProviderDesc + "String_Node_Str");
          for (          RuleLifecycleListener listener : listeners) {
            listener.beforeRuleOperationsPerformed(event,subContext,rule);
          }
          List<Operation> preOperations=subContext.getPreOperations();
          for (          Operation preOperation : preOperations) {
            preOperation.perform(event,subContext);
          }
          if (event.getFlow().isHandled())           break;
          rule.perform(event,subContext);
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleOperationsPerformed(event,subContext,rule);
          }
          if (event.getFlow().isHandled())           break;
          List<Operation> postOperations=subContext.getPostOperations();
          for (          Operation postOperation : postOperations) {
            postOperation.perform(event,subContext);
          }
          if (event.getFlow().isHandled())           break;
        }
 else {
          for (          RuleLifecycleListener listener : listeners) {
            listener.afterRuleConditionEvaluation(event,subContext,rule,false);
          }
        }
      }
  finally {
        boolean autocommit=true;
        if (ruleContext != null && ruleContext.containsKey(RuleMetadata.AUTO_COMMIT)) {
          autocommit=(Boolean)ruleContext.get(RuleMetadata.AUTO_COMMIT);
        }
        if (autocommit) {
          event.getGraphContext().getGraph().getBaseGraph().commit();
        }
        event.selectionPop();
        long ruleTimeCompleted=System.currentTimeMillis();
        if (ruleContext != null) {
          int timeTaken=(int)(ruleTimeCompleted - ruleTimeStarted);
          logTimeTakenByRuleProvider(event.getGraphContext(),ruleContext,i,timeTaken);
        }
      }
    }
 catch (    RuntimeException ex) {
      String exMsg="String_Node_Str" + rule;
      String logMsg=exMsg + "String_Node_Str" + ex.getMessage();
      log.severe(logMsg);
      if (ruleContext != null) {
        Object origin=ruleContext.get(RuleMetadata.ORIGIN);
        if (origin != null)         exMsg+="String_Node_Str" + origin;
        Object location=ruleContext.get(org.ocpsoft.rewrite.config.RuleMetadata.PROVIDER_LOCATION);
        if (location != null)         exMsg+="String_Node_Str" + location;
      }
      throw new WindupException(exMsg,ex);
    }
  }
  for (  RuleLifecycleListener listener : listeners) {
    listener.afterExecution();
  }
}