Program: 32148
Project: 32148
Buggy source:
private void updateRules(BingRuleSet ruleSet){
synchronized (this) {
    mRules.clear();
    if (ruleSet.override != null) {
      ruleSet.override=new ArrayList<BingRule>(ruleSet.override);
      for (      BingRule rule : ruleSet.override) {
        rule.kind=BingRule.KIND_OVERRIDE;
      }
      mRules.addAll(ruleSet.override);
    }
 else {
      ruleSet.override=new ArrayList<BingRule>(ruleSet.override);
    }
    if (ruleSet.content != null) {
      ruleSet.content=new ArrayList<ContentRule>(ruleSet.content);
      for (      BingRule rule : ruleSet.content) {
        rule.kind=BingRule.KIND_CONTENT;
      }
      addContentRules(ruleSet.content);
    }
 else {
      ruleSet.content=new ArrayList<ContentRule>();
    }
    if (ruleSet.room != null) {
      ruleSet.room=new ArrayList<BingRule>(ruleSet.room);
      for (      BingRule rule : ruleSet.room) {
        rule.kind=BingRule.KIND_ROOM;
      }
      addRoomRules(ruleSet.room);
    }
 else {
      ruleSet.room=new ArrayList<BingRule>();
    }
    if (ruleSet.sender != null) {
      ruleSet.sender=new ArrayList<BingRule>(ruleSet.sender);
      for (      BingRule rule : ruleSet.sender) {
        rule.kind=BingRule.KIND_SENDER;
      }
      addSenderRules(ruleSet.sender);
    }
 else {
      ruleSet.sender=new ArrayList<BingRule>();
    }
    if (ruleSet.underride != null) {
      ruleSet.underride=new ArrayList<BingRule>(ruleSet.underride);
      for (      BingRule rule : ruleSet.underride) {
        rule.kind=BingRule.KIND_UNDERRIDE;
      }
      mRules.addAll(ruleSet.underride);
    }
 else {
      ruleSet.underride=new ArrayList<BingRule>();
    }
    mRulesSet=ruleSet;
  }
}

Fixed version (ground truth):
/** 
 * Update mRulesSet with the new one.
 * @param ruleSet the new ruleSet to apply
 */
private void updateRules(BingRuleSet ruleSet){
synchronized (this) {
    mRules.clear();
    if (null == ruleSet) {
      mRulesSet=new BingRuleSet();
      return;
    }
    if (ruleSet.override != null) {
      ruleSet.override=new ArrayList<BingRule>(ruleSet.override);
      for (      BingRule rule : ruleSet.override) {
        rule.kind=BingRule.KIND_OVERRIDE;
      }
      mRules.addAll(ruleSet.override);
    }
 else {
      ruleSet.override=new ArrayList<BingRule>(ruleSet.override);
    }
    if (ruleSet.content != null) {
      ruleSet.content=new ArrayList<ContentRule>(ruleSet.content);
      for (      BingRule rule : ruleSet.content) {
        rule.kind=BingRule.KIND_CONTENT;
      }
      addContentRules(ruleSet.content);
    }
 else {
      ruleSet.content=new ArrayList<ContentRule>();
    }
    if (ruleSet.room != null) {
      ruleSet.room=new ArrayList<BingRule>(ruleSet.room);
      for (      BingRule rule : ruleSet.room) {
        rule.kind=BingRule.KIND_ROOM;
      }
      addRoomRules(ruleSet.room);
    }
 else {
      ruleSet.room=new ArrayList<BingRule>();
    }
    if (ruleSet.sender != null) {
      ruleSet.sender=new ArrayList<BingRule>(ruleSet.sender);
      for (      BingRule rule : ruleSet.sender) {
        rule.kind=BingRule.KIND_SENDER;
      }
      addSenderRules(ruleSet.sender);
    }
 else {
      ruleSet.sender=new ArrayList<BingRule>();
    }
    if (ruleSet.underride != null) {
      ruleSet.underride=new ArrayList<BingRule>(ruleSet.underride);
      for (      BingRule rule : ruleSet.underride) {
        rule.kind=BingRule.KIND_UNDERRIDE;
      }
      mRules.addAll(ruleSet.underride);
    }
 else {
      ruleSet.underride=new ArrayList<BingRule>();
    }
    mRulesSet=ruleSet;
  }
}