Program: 11892
Project: 11892
Buggy source:
protected void applyPullRules(IDOMNode sourceNode,IDOMNode targetNode){
  try {
    for (Iterator pullRules=jControlModel.getPullRules().iterator(); pullRules.hasNext(); ) {
      JControlModel.PullRule pullRule=(JControlModel.PullRule)pullRules.next();
      if (sourcePatternDictionary.isMarkedUp(pullRule.getSourceMarkup(),sourceNode) && targetPatternDictionary.isMarkedUp(pullRule.getTargetMarkup(),targetNode) && pullRule.getSourceGetFeature().getFeatureClass() != null && pullRule.getSourceGetFeature().getFeatureClass().isInstance(sourceNode) && pullRule.getTargetPutFeature().getFeatureClass() != null && pullRule.getTargetPutFeature().getFeatureClass().isInstance(targetNode)) {
        Method sourceGetMethod=pullRule.getSourceGetFeature().getFeatureMethod();
        Object value=sourceGetMethod.invoke(sourceNode,noArguments);
        Method targetPutMethod=pullRule.getTargetPutFeature().getFeatureMethod();
        if (!sourceGetMethod.getReturnType().isArray() || targetPutMethod.getParameterTypes()[0].isAssignableFrom(sourceGetMethod.getReturnType())) {
          if (value instanceof String) {
            String stringValue=(String)value;
            stringValue=applyFormatRules(stringValue);
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String oldStringValue=(String)sourceGetMethod.invoke(targetNode,noArguments);
              Matcher sourceMatcher=sourceTransfer.matcher(stringValue);
              Matcher targetMatcher=sourceTransfer.matcher(oldStringValue);
              if (sourceMatcher.groupCount() >= 1 && targetMatcher.groupCount() >= 1) {
                StringBuffer result=new StringBuffer();
                int index=0;
                while (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,noArguments);
            if (value == null ? oldValue == null : value.equals(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") && jControlModel.getBlockPattern() != null && ((IDOMMethod)targetNode).getComment() != null && jControlModel.getBlockPattern().matcher(((IDOMMethod)targetNode).getComment()).find()) {
              continue;
            }
            targetPutMethod.invoke(targetNode,new Object[]{value});
            if (targetPutMethod.getName().equals("String_Node_Str") && sourceNode instanceof IDOMMethod) {
              IDOMMethod sourceMethod=(IDOMMethod)sourceNode;
              IDOMMethod targetMethod=(IDOMMethod)targetNode;
              String[] sourceParameterNames=sourceMethod.getParameterNames();
              String[] targetParameterTypes=targetMethod.getParameterTypes();
              targetMethod.setParameters(targetParameterTypes,sourceParameterNames);
            }
          }
        }
 else {
          ArrayList additionalStrings=new ArrayList();
          String[] sourceStrings=(String[])value;
          if (sourceStrings != null) {
            additionalStrings.addAll(Arrays.asList(sourceStrings));
          }
          if (targetPutMethod.getName().equals("String_Node_Str")) {
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String comment=((IDOMMember)targetNode).getComment();
              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);
                  }
                }
              }
            }
            IDOMType type=(IDOMType)targetNode;
            String[] superInterfaces=(String[])additionalStrings.toArray(new String[additionalStrings.size()]);
            if (type.getSuperInterfaces() == null ? superInterfaces.length != 0 : !Arrays.equals(type.getSuperInterfaces(),superInterfaces)) {
              type.setSuperInterfaces((String[])additionalStrings.toArray(new String[additionalStrings.size()]));
            }
          }
 else {
            String[] oldStringValues=(String[])sourceGetMethod.invoke(targetNode,noArguments);
            List old=oldStringValues == null ? Collections.EMPTY_LIST : Arrays.asList(oldStringValues);
            for (Iterator i=additionalStrings.iterator(); i.hasNext(); ) {
              String string=(String)i.next();
              if (!old.contains(string)) {
                targetPutMethod.invoke(targetNode,new Object[]{string});
              }
            }
          }
        }
      }
    }
  }
 catch (  InvocationTargetException exception) {
  }
catch (  IllegalAccessException exception) {
  }
}

Fixed version (ground truth):
protected void applyPullRules(IDOMNode sourceNode,IDOMNode targetNode){
  try {
    for (Iterator pullRules=jControlModel.getPullRules().iterator(); pullRules.hasNext(); ) {
      JControlModel.PullRule pullRule=(JControlModel.PullRule)pullRules.next();
      if (sourcePatternDictionary.isMarkedUp(pullRule.getSourceMarkup(),sourceNode) && targetPatternDictionary.isMarkedUp(pullRule.getTargetMarkup(),targetNode) && pullRule.getSourceGetFeature().getFeatureMethod() != null && pullRule.getSourceGetFeature().getFeatureClass().isInstance(sourceNode) && pullRule.getTargetPutFeature().getFeatureMethod() != null && pullRule.getTargetPutFeature().getFeatureClass().isInstance(targetNode)) {
        Method sourceGetMethod=pullRule.getSourceGetFeature().getFeatureMethod();
        Object value=sourceGetMethod.invoke(sourceNode,noArguments);
        Method targetPutMethod=pullRule.getTargetPutFeature().getFeatureMethod();
        if (!sourceGetMethod.getReturnType().isArray() || targetPutMethod.getParameterTypes()[0].isAssignableFrom(sourceGetMethod.getReturnType())) {
          if (value instanceof String) {
            String stringValue=(String)value;
            stringValue=applyFormatRules(stringValue);
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String oldStringValue=(String)sourceGetMethod.invoke(targetNode,noArguments);
              Matcher sourceMatcher=sourceTransfer.matcher(stringValue);
              Matcher targetMatcher=sourceTransfer.matcher(oldStringValue);
              if (sourceMatcher.groupCount() >= 1 && targetMatcher.groupCount() >= 1) {
                StringBuffer result=new StringBuffer();
                int index=0;
                while (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,noArguments);
            if (value == null ? oldValue == null : value.equals(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") && jControlModel.getBlockPattern() != null && ((IDOMMethod)targetNode).getComment() != null && jControlModel.getBlockPattern().matcher(((IDOMMethod)targetNode).getComment()).find()) {
              continue;
            }
            targetPutMethod.invoke(targetNode,new Object[]{value});
            if (targetPutMethod.getName().equals("String_Node_Str") && sourceNode instanceof IDOMMethod) {
              IDOMMethod sourceMethod=(IDOMMethod)sourceNode;
              IDOMMethod targetMethod=(IDOMMethod)targetNode;
              String[] sourceParameterNames=sourceMethod.getParameterNames();
              String[] targetParameterTypes=targetMethod.getParameterTypes();
              targetMethod.setParameters(targetParameterTypes,sourceParameterNames);
            }
          }
        }
 else {
          ArrayList additionalStrings=new ArrayList();
          String[] sourceStrings=(String[])value;
          if (sourceStrings != null) {
            additionalStrings.addAll(Arrays.asList(sourceStrings));
          }
          if (targetPutMethod.getName().equals("String_Node_Str")) {
            Pattern sourceTransfer=pullRule.getSourceTransfer();
            if (sourceTransfer != null) {
              String comment=((IDOMMember)targetNode).getComment();
              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);
                  }
                }
              }
            }
            IDOMType type=(IDOMType)targetNode;
            String[] superInterfaces=(String[])additionalStrings.toArray(new String[additionalStrings.size()]);
            if (type.getSuperInterfaces() == null ? superInterfaces.length != 0 : !Arrays.equals(type.getSuperInterfaces(),superInterfaces)) {
              type.setSuperInterfaces((String[])additionalStrings.toArray(new String[additionalStrings.size()]));
            }
          }
 else {
            String[] oldStringValues=(String[])sourceGetMethod.invoke(targetNode,noArguments);
            List old=oldStringValues == null ? Collections.EMPTY_LIST : Arrays.asList(oldStringValues);
            for (Iterator i=additionalStrings.iterator(); i.hasNext(); ) {
              String string=(String)i.next();
              if (!old.contains(string)) {
                targetPutMethod.invoke(targetNode,new Object[]{string});
              }
            }
          }
        }
      }
    }
  }
 catch (  InvocationTargetException exception) {
  }
catch (  IllegalAccessException exception) {
  }
}