Program: 161832
Project: 161832
Buggy source:
private void writeRIFLSpecification(String targetFileName,Set<AndroidMethod> methods) throws IOException {
  RIFLDocument doc=new RIFLDocument();
  DomainSpec topDomain=doc.new DomainSpec("String_Node_Str");
  DomainSpec bottomDomain=doc.new DomainSpec("String_Node_Str");
  doc.getDomains().add(topDomain);
  doc.getDomains().add(bottomDomain);
  doc.getFlowPolicy().add(doc.new FlowPair(topDomain,topDomain));
  doc.getFlowPolicy().add(doc.new FlowPair(bottomDomain,bottomDomain));
  doc.getFlowPolicy().add(doc.new FlowPair(bottomDomain,topDomain));
  Map<String,Category> categoryMap=new HashMap<String,Category>();
  Map<CATEGORY,Assignable> assignableMap=new HashMap<CATEGORY,Assignable>();
  for (  AndroidMethod am : methods) {
    SootMethodAndClass smac=SootMethodRepresentationParser.v().parseSootMethodString(am.getSignature());
    String halfSignature=am.getSubSignature().substring(am.getSubSignature().indexOf("String_Node_Str") + 1);
    if (am.getCategory() != null && !categoryMap.containsKey(am.getCategory())) {
      if (am.isSource()) {
        String catName=am.getCategory().toString() + "String_Node_Str";
        Category riflCat=doc.new Category(catName);
        categoryMap.put(catName,riflCat);
        Assignable riflAssignable=doc.new Assignable(catName,riflCat);
        assignableMap.put(am.getCategory(),riflAssignable);
        doc.getInterfaceSpec().getSourcesSinks().add(riflAssignable);
        doc.getDomainAssignment().add(doc.new DomainAssignment(riflAssignable,topDomain));
      }
 else       if (am.isSink()) {
        String catName=am.getCategory().toString() + "String_Node_Str";
        Category riflCat=doc.new Category(catName);
        categoryMap.put(catName,riflCat);
        Assignable riflAssignable=doc.new Assignable(catName,riflCat);
        assignableMap.put(am.getCategory(),riflAssignable);
        doc.getInterfaceSpec().getSourcesSinks().add(riflAssignable);
        doc.getDomainAssignment().add(doc.new DomainAssignment(riflAssignable,bottomDomain));
      }
    }
    if (am.getCategory() != null && (am.isSource() || am.isSink())) {
      String catName=am.getCategory().toString() + (am.isSource() ? "String_Node_Str" : "String_Node_Str");
      Category riflCat=categoryMap.get(catName);
      if (riflCat == null)       throw new RuntimeException("String_Node_Str" + catName);
      if (am.isSource()) {
        SourceSinkSpec sourceSinkSpec=doc.new JavaReturnValueSpec(SourceSinkType.Source,smac.getClassName(),halfSignature);
        riflCat.getElements().add(sourceSinkSpec);
      }
 else       if (am.isSink()) {
        for (int i=0; i < am.getParameters().size(); i++) {
          SourceSinkSpec sourceSinkSpec=doc.new JavaParameterSpec(SourceSinkType.Sink,smac.getClassName(),halfSignature,i + 1);
          riflCat.getElements().add(sourceSinkSpec);
        }
      }
    }
  }
  RIFLWriter writer=new RIFLWriter(doc);
  String fileName=appendFileName(targetFileName,"String_Node_Str");
  PrintWriter wr=new PrintWriter(fileName);
  wr.print(writer.write());
  wr.flush();
  wr.close();
}

Fixed version (ground truth):
private void writeRIFLSpecification(String targetFileName,Set<AndroidMethod> methods) throws IOException {
  RIFLDocument doc=new RIFLDocument();
  DomainSpec topDomain=doc.new DomainSpec("String_Node_Str");
  DomainSpec bottomDomain=doc.new DomainSpec("String_Node_Str");
  doc.getDomains().add(topDomain);
  doc.getDomains().add(bottomDomain);
  doc.getFlowPolicy().add(doc.new FlowPair(topDomain,topDomain));
  doc.getFlowPolicy().add(doc.new FlowPair(bottomDomain,bottomDomain));
  doc.getFlowPolicy().add(doc.new FlowPair(bottomDomain,topDomain));
  Map<String,Category> categoryMap=new HashMap<String,Category>();
  Map<CATEGORY,Assignable> assignableMap=new HashMap<CATEGORY,Assignable>();
  for (  AndroidMethod am : methods) {
    SootMethodAndClass smac=SootMethodRepresentationParser.v().parseSootMethodString(am.getSignature());
    String halfSignature=am.getSubSignature().substring(am.getSubSignature().indexOf("String_Node_Str") + 1);
    if (am.getCategory() != null) {
      if (am.isSource()) {
        String catName=am.getCategory().toString() + "String_Node_Str";
        if (!categoryMap.containsKey(catName)) {
          Category riflCat=doc.new Category(catName);
          categoryMap.put(catName,riflCat);
          Assignable riflAssignable=doc.new Assignable(catName,riflCat);
          assignableMap.put(am.getCategory(),riflAssignable);
          doc.getInterfaceSpec().getSourcesSinks().add(riflAssignable);
          doc.getDomainAssignment().add(doc.new DomainAssignment(riflAssignable,topDomain));
        }
      }
 else       if (am.isSink()) {
        String catName=am.getCategory().toString() + "String_Node_Str";
        if (!categoryMap.containsKey(catName)) {
          Category riflCat=doc.new Category(catName);
          categoryMap.put(catName,riflCat);
          Assignable riflAssignable=doc.new Assignable(catName,riflCat);
          assignableMap.put(am.getCategory(),riflAssignable);
          doc.getInterfaceSpec().getSourcesSinks().add(riflAssignable);
          doc.getDomainAssignment().add(doc.new DomainAssignment(riflAssignable,bottomDomain));
        }
      }
    }
    if (am.getCategory() != null && (am.isSource() || am.isSink())) {
      String catName=am.getCategory().toString() + (am.isSource() ? "String_Node_Str" : "String_Node_Str");
      Category riflCat=categoryMap.get(catName);
      if (riflCat == null)       throw new RuntimeException("String_Node_Str" + catName);
      if (am.isSource()) {
        SourceSinkSpec sourceSinkSpec=doc.new JavaReturnValueSpec(SourceSinkType.Source,smac.getClassName(),halfSignature);
        riflCat.getElements().add(sourceSinkSpec);
      }
 else       if (am.isSink()) {
        for (int i=0; i < am.getParameters().size(); i++) {
          SourceSinkSpec sourceSinkSpec=doc.new JavaParameterSpec(SourceSinkType.Sink,smac.getClassName(),halfSignature,i + 1);
          riflCat.getElements().add(sourceSinkSpec);
        }
      }
    }
  }
  RIFLWriter writer=new RIFLWriter(doc);
  String fileName=appendFileName(targetFileName,"String_Node_Str");
  PrintWriter wr=new PrintWriter(fileName);
  wr.print(writer.write());
  wr.flush();
  wr.close();
}