Program: 11893
Project: 11893
Buggy source:
protected void applyPullRules(JNode sourceNode,JNode targetNode){
  try {
    for (    JControlModel.PullRule pullRule : getControlModel().getPullRules()) {
      if (pullRule.getSourceGetFeature().getFeatureClass() != null && pullRule.getSourceGetFeature().getFeatureClass().isInstance(sourceNode) && pullRule.getTargetPutFeature().getFeatureClass() != null && pullRule.getTargetPutFeature().getFeatureClass().isInstance(targetNode) && sourcePatternDictionary.isMarkedUp(pullRule.getSourceMarkup(),pullRule.getSourceParentMarkup(),sourceNode) && targetPatternDictionary.isMarkedUp(pullRule.getTargetMarkup(),pullRule.getTargetParentMarkup(),targetNode)) {
        if (pullRule.getEqualityFeature() != null) {
          Method equalityFeatureMethod=pullRule.getEqualityFeature().getFeatureMethod();
          Object value1=equalityFeatureMethod.invoke(sourceNode,NO_ARGUMENTS);
          Object value2=equalityFeatureMethod.invoke(targetNode,NO_ARGUMENTS);
          if (value1 == null ? value2 != null : !value1.equals(value2)) {
            continue;
          }
        }
        Method sourceGetMethod=pullRule.getSourceGetFeature().getFeatureMethod();
        Object value=sourceGetMethod.invoke(sourceNode,NO_ARGUMENTS);
        Method targetPutMethod=pullRule.getTargetPutFeature().getFeatureMethod();
        if (!sourceGetMethod.getReturnType().isArray() || targetPutMethod.getParameterTypes()[0].isAssignableFrom(sourceGetMethod.getReturnType())) {
          if (value instanceof String) {
            String stringValue=(String)value;
            stringValue=getControlModel().getFacadeHelper().applyFormatRules(stringValue);
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String oldStringValue=(String)sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
              if (oldStringValue != null) {
                Matcher sourceMatcher=sourceTransfer.matcher(stringValue);
                Matcher targetMatcher=sourceTransfer.matcher(oldStringValue);
                if (sourceMatcher.groupCount() >= 1 && targetMatcher.groupCount() >= 1) {
                  StringBuilder result=new StringBuilder();
                  int index=0;
                  int sourceStart=0;
                  int targetStart=0;
                  if (sourceTransfer.pattern().startsWith("String_Node_Str")) {
                    sourceStart=getStartIndex(stringValue);
                    targetStart=getStartIndex(oldStringValue);
                  }
                  for (boolean match=sourceMatcher.find(sourceStart) && targetMatcher.find(targetStart); match; match=sourceMatcher.find() && targetMatcher.find()) {
                    result.append(stringValue.substring(index,sourceMatcher.start(1)));
                    result.append(targetMatcher.group(1));
                    index=sourceMatcher.end(1);
                  }
                  if (result.length() == 0) {
                    stringValue=null;
                  }
 else {
                    result.append(stringValue.substring(index));
                    stringValue=result.toString();
                  }
                }
 else {
                  stringValue=null;
                }
              }
            }
            value=stringValue;
          }
          if (value != null || targetPutMethod.getName().equals("String_Node_Str") || targetPutMethod.getName().equals("String_Node_Str") || targetPutMethod.getName().equals("String_Node_Str")) {
            Object oldValue=sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
            if (value == null ? oldValue == null : value.equals(oldValue)) {
              continue;
            }
 else             if (value instanceof Object[] && oldValue instanceof Object[] && Arrays.equals((Object[])value,(Object[])oldValue)) {
              continue;
            }
 else             if (targetPutMethod.getName().equals("String_Node_Str")) {
              if (oldValue != null && value != null && ((String)oldValue).trim().equals(((String)value).trim())) {
                continue;
              }
            }
            if (sourceGetMethod.getName().equals("String_Node_Str") && getControlModel().getBlockPattern() != null && ((JMethod)targetNode).getComment() != null && getControlModel().getBlockPattern().matcher(((JMethod)targetNode).getComment()).find()) {
              continue;
            }
            targetPutMethod.invoke(targetNode,new Object[]{value});
            targetCompilationChanged=true;
            if (targetPutMethod.getName().equals("String_Node_Str") && sourceNode instanceof JMethod) {
              JMethod sourceMethod=(JMethod)sourceNode;
              JMethod targetMethod=(JMethod)targetNode;
              String[] sourceParameterNames=sourceMethod.getParameterNames();
              targetMethod.setParameterNames(sourceParameterNames);
            }
          }
        }
 else {
          ArrayList<String> additionalStrings=new ArrayList<String>();
          String[] sourceStrings=(String[])value;
          if (sourceStrings != null) {
            additionalStrings.addAll(Arrays.asList(sourceStrings));
          }
          if (targetPutMethod.getName().equals("String_Node_Str")) {
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            String comment=((JMember)targetNode).getComment();
            if (sourceTransfer != null && comment != null) {
              Matcher matcher=sourceTransfer.matcher(comment);
              while (matcher.find() && matcher.groupCount() >= 1) {
                String clientStrings=comment.substring(matcher.start(matcher.groupCount()),matcher.end(matcher.groupCount()));
                for (StringTokenizer stringTokenizer=new StringTokenizer(clientStrings,"String_Node_Str"); stringTokenizer.hasMoreTokens(); ) {
                  String token=stringTokenizer.nextToken();
                  if (!additionalStrings.contains(token)) {
                    additionalStrings.add(token);
                  }
                }
              }
            }
            String[] oldSuperInterfaces=(String[])sourceGetMethod.invoke(targetNode);
            String[] superInterfaces=additionalStrings.toArray(new String[additionalStrings.size()]);
            if (oldSuperInterfaces == null ? superInterfaces.length != 0 : !Arrays.equals(oldSuperInterfaces,superInterfaces)) {
              Method putMethod=targetNode.getClass().getMethod("String_Node_Str",String[].class);
              putMethod.invoke(targetNode,new Object[]{superInterfaces});
              targetCompilationChanged=true;
            }
          }
 else {
            String[] oldStringValues=(String[])sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
            List<String> old=oldStringValues == null ? Collections.<String>emptyList() : Arrays.<String>asList(oldStringValues);
            for (            String string : additionalStrings) {
              if (!old.contains(string)) {
                targetPutMethod.invoke(targetNode,new Object[]{string});
                targetCompilationChanged=true;
              }
            }
          }
        }
      }
    }
  }
 catch (  InvocationTargetException exception) {
    if (DEBUG) {
      exception.printStackTrace();
    }
  }
catch (  IllegalAccessException exception) {
    if (DEBUG) {
      exception.printStackTrace();
    }
  }
catch (  SecurityException e) {
    if (DEBUG) {
      e.printStackTrace();
    }
  }
catch (  NoSuchMethodException e) {
    if (DEBUG) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
protected void applyPullRules(JNode sourceNode,JNode targetNode){
  try {
    for (    JControlModel.PullRule pullRule : getControlModel().getPullRules()) {
      if (pullRule.getSourceGetFeature().getFeatureMethod() != null && pullRule.getSourceGetFeature().getFeatureClass().isInstance(sourceNode) && pullRule.getTargetPutFeature().getFeatureMethod() != null && pullRule.getTargetPutFeature().getFeatureClass().isInstance(targetNode) && sourcePatternDictionary.isMarkedUp(pullRule.getSourceMarkup(),pullRule.getSourceParentMarkup(),sourceNode) && targetPatternDictionary.isMarkedUp(pullRule.getTargetMarkup(),pullRule.getTargetParentMarkup(),targetNode)) {
        if (pullRule.getEqualityFeature() != null) {
          Method equalityFeatureMethod=pullRule.getEqualityFeature().getFeatureMethod();
          Object value1=equalityFeatureMethod.invoke(sourceNode,NO_ARGUMENTS);
          Object value2=equalityFeatureMethod.invoke(targetNode,NO_ARGUMENTS);
          if (value1 == null ? value2 != null : !value1.equals(value2)) {
            continue;
          }
        }
        Method sourceGetMethod=pullRule.getSourceGetFeature().getFeatureMethod();
        Object value=sourceGetMethod.invoke(sourceNode,NO_ARGUMENTS);
        Method targetPutMethod=pullRule.getTargetPutFeature().getFeatureMethod();
        if (!sourceGetMethod.getReturnType().isArray() || targetPutMethod.getParameterTypes()[0].isAssignableFrom(sourceGetMethod.getReturnType())) {
          if (value instanceof String) {
            String stringValue=(String)value;
            stringValue=getControlModel().getFacadeHelper().applyFormatRules(stringValue);
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String oldStringValue=(String)sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
              if (oldStringValue != null) {
                Matcher sourceMatcher=sourceTransfer.matcher(stringValue);
                Matcher targetMatcher=sourceTransfer.matcher(oldStringValue);
                if (sourceMatcher.groupCount() >= 1 && targetMatcher.groupCount() >= 1) {
                  StringBuilder result=new StringBuilder();
                  int index=0;
                  int sourceStart=0;
                  int targetStart=0;
                  if (sourceTransfer.pattern().startsWith("String_Node_Str")) {
                    sourceStart=getStartIndex(stringValue);
                    targetStart=getStartIndex(oldStringValue);
                  }
                  for (boolean match=sourceMatcher.find(sourceStart) && targetMatcher.find(targetStart); match; match=sourceMatcher.find() && targetMatcher.find()) {
                    result.append(stringValue.substring(index,sourceMatcher.start(1)));
                    result.append(targetMatcher.group(1));
                    index=sourceMatcher.end(1);
                  }
                  if (result.length() == 0) {
                    stringValue=null;
                  }
 else {
                    result.append(stringValue.substring(index));
                    stringValue=result.toString();
                  }
                }
 else {
                  stringValue=null;
                }
              }
            }
            value=stringValue;
          }
          if (value != null || targetPutMethod.getName().equals("String_Node_Str") || targetPutMethod.getName().equals("String_Node_Str") || targetPutMethod.getName().equals("String_Node_Str")) {
            Object oldValue=sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
            if (value == null ? oldValue == null : value.equals(oldValue)) {
              continue;
            }
 else             if (value instanceof Object[] && oldValue instanceof Object[] && Arrays.equals((Object[])value,(Object[])oldValue)) {
              continue;
            }
 else             if (targetPutMethod.getName().equals("String_Node_Str")) {
              if (oldValue != null && value != null && ((String)oldValue).trim().equals(((String)value).trim())) {
                continue;
              }
            }
            if (sourceGetMethod.getName().equals("String_Node_Str") && getControlModel().getBlockPattern() != null && ((JMethod)targetNode).getComment() != null && getControlModel().getBlockPattern().matcher(((JMethod)targetNode).getComment()).find()) {
              continue;
            }
            targetPutMethod.invoke(targetNode,new Object[]{value});
            targetCompilationChanged=true;
            if (targetPutMethod.getName().equals("String_Node_Str") && sourceNode instanceof JMethod) {
              JMethod sourceMethod=(JMethod)sourceNode;
              JMethod targetMethod=(JMethod)targetNode;
              String[] sourceParameterNames=sourceMethod.getParameterNames();
              targetMethod.setParameterNames(sourceParameterNames);
            }
          }
        }
 else {
          ArrayList<String> additionalStrings=new ArrayList<String>();
          String[] sourceStrings=(String[])value;
          if (sourceStrings != null) {
            additionalStrings.addAll(Arrays.asList(sourceStrings));
          }
          if (targetPutMethod.getName().equals("String_Node_Str")) {
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            String comment=((JMember)targetNode).getComment();
            if (sourceTransfer != null && comment != null) {
              Matcher matcher=sourceTransfer.matcher(comment);
              while (matcher.find() && matcher.groupCount() >= 1) {
                String clientStrings=comment.substring(matcher.start(matcher.groupCount()),matcher.end(matcher.groupCount()));
                for (StringTokenizer stringTokenizer=new StringTokenizer(clientStrings,"String_Node_Str"); stringTokenizer.hasMoreTokens(); ) {
                  String token=stringTokenizer.nextToken();
                  if (!additionalStrings.contains(token)) {
                    additionalStrings.add(token);
                  }
                }
              }
            }
            String[] oldSuperInterfaces=(String[])sourceGetMethod.invoke(targetNode);
            String[] superInterfaces=additionalStrings.toArray(new String[additionalStrings.size()]);
            if (oldSuperInterfaces == null ? superInterfaces.length != 0 : !Arrays.equals(oldSuperInterfaces,superInterfaces)) {
              Method putMethod=targetNode.getClass().getMethod("String_Node_Str",String[].class);
              putMethod.invoke(targetNode,new Object[]{superInterfaces});
              targetCompilationChanged=true;
            }
          }
 else {
            String[] oldStringValues=(String[])sourceGetMethod.invoke(targetNode,NO_ARGUMENTS);
            List<String> old=oldStringValues == null ? Collections.<String>emptyList() : Arrays.<String>asList(oldStringValues);
            for (            String string : additionalStrings) {
              if (!old.contains(string)) {
                targetPutMethod.invoke(targetNode,new Object[]{string});
                targetCompilationChanged=true;
              }
            }
          }
        }
      }
    }
  }
 catch (  InvocationTargetException exception) {
    if (DEBUG) {
      exception.printStackTrace();
    }
  }
catch (  IllegalAccessException exception) {
    if (DEBUG) {
      exception.printStackTrace();
    }
  }
catch (  SecurityException e) {
    if (DEBUG) {
      e.printStackTrace();
    }
  }
catch (  NoSuchMethodException e) {
    if (DEBUG) {
      e.printStackTrace();
    }
  }
}