Program: 6361
Project: 6361
Buggy source:
private List<MetadataEntry> executeSearch(final String namespaceId,final String column,final String searchValue,final MetadataSearchTargetType type){
  List<MetadataEntry> results=new LinkedList<>();
  Scanner scanner;
  String namespacedSearchValue=namespaceId + KEYVALUE_SEPARATOR + searchValue.toLowerCase();
  boolean modifiedTagsKVSearch=false;
  final String unmodifiedTagKeyValue=searchValue.toLowerCase();
  if (KEYVALUE_COLUMN.equals(column) && unmodifiedTagKeyValue.startsWith(TAGS_KEY + KEYVALUE_SEPARATOR)) {
    namespacedSearchValue=namespacedSearchValue.substring(0,namespacedSearchValue.lastIndexOf(KEYVALUE_SEPARATOR) + 1) + "String_Node_Str";
    modifiedTagsKVSearch=true;
  }
  if (namespacedSearchValue.endsWith("String_Node_Str")) {
    byte[] startKey=Bytes.toBytes(namespacedSearchValue.substring(0,namespacedSearchValue.lastIndexOf("String_Node_Str")));
    byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
    scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  }
 else {
    byte[] value=Bytes.toBytes(namespacedSearchValue);
    scanner=indexedTable.readByIndex(Bytes.toBytes(column),value);
  }
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=MdsValueKey.getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      if (modifiedTagsKVSearch) {
        boolean isMatch=false;
        if ((TAGS_KEY + KEYVALUE_SEPARATOR + "String_Node_Str").equals(unmodifiedTagKeyValue)) {
          isMatch=true;
        }
 else {
          Iterable<String> tagValues=Splitter.on(TAGS_SEPARATOR).omitEmptyStrings().trimResults().split(rowValue);
          for (          String tagValue : tagValues) {
            String prefixedTagValue=TAGS_KEY + KEYVALUE_SEPARATOR + tagValue;
            if (!unmodifiedTagKeyValue.endsWith("String_Node_Str")) {
              if (prefixedTagValue.equals(unmodifiedTagKeyValue)) {
                isMatch=true;
                break;
              }
            }
 else {
              int endAsteriskIndex=unmodifiedTagKeyValue.lastIndexOf("String_Node_Str");
              if (prefixedTagValue.startsWith(unmodifiedTagKeyValue.substring(0,endAsteriskIndex))) {
                isMatch=true;
                break;
              }
            }
          }
        }
        if (!isMatch) {
          continue;
        }
      }
      Id.NamespacedId targetId=MdsValueKey.getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=MdsValueKey.getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(MetadataDataset.VALUE_COLUMN)));
      MetadataEntry entry=new MetadataEntry(targetId,key,value);
      results.add(entry);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}

Fixed version (ground truth):
private List<MetadataEntry> executeSearch(final String namespaceId,final String column,final String searchValue,final MetadataSearchTargetType type){
  List<MetadataEntry> results=new LinkedList<>();
  Scanner scanner;
  String namespacedSearchValue=namespaceId + KEYVALUE_SEPARATOR + searchValue.toLowerCase();
  boolean modifiedTagsKVSearch=false;
  final String unmodifiedTagKeyValue=searchValue.toLowerCase();
  if (KEYVALUE_COLUMN.equals(column) && unmodifiedTagKeyValue.startsWith(TAGS_KEY + KEYVALUE_SEPARATOR)) {
    namespacedSearchValue=namespacedSearchValue.substring(0,namespacedSearchValue.lastIndexOf(KEYVALUE_SEPARATOR) + 1) + "String_Node_Str";
    modifiedTagsKVSearch=true;
  }
  if (namespacedSearchValue.endsWith("String_Node_Str")) {
    byte[] startKey=Bytes.toBytes(namespacedSearchValue.substring(0,namespacedSearchValue.lastIndexOf("String_Node_Str")));
    byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
    scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  }
 else {
    byte[] value=Bytes.toBytes(namespacedSearchValue);
    scanner=indexedTable.readByIndex(Bytes.toBytes(column),value);
  }
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=MdsValueKey.getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      if (modifiedTagsKVSearch) {
        boolean isMatch=false;
        if ((TAGS_KEY + KEYVALUE_SEPARATOR + "String_Node_Str").equals(unmodifiedTagKeyValue)) {
          isMatch=true;
        }
 else {
          Iterable<String> tagValues=Splitter.on(TAGS_SEPARATOR).omitEmptyStrings().trimResults().split(rowValue);
          for (          String tagValue : tagValues) {
            String prefixedTagValue=TAGS_KEY + KEYVALUE_SEPARATOR + tagValue;
            if (!unmodifiedTagKeyValue.endsWith("String_Node_Str")) {
              if (prefixedTagValue.equals(unmodifiedTagKeyValue)) {
                isMatch=true;
                break;
              }
            }
 else {
              int endAsteriskIndex=unmodifiedTagKeyValue.lastIndexOf("String_Node_Str");
              if (prefixedTagValue.startsWith(unmodifiedTagKeyValue.substring(0,endAsteriskIndex))) {
                isMatch=true;
                break;
              }
            }
          }
        }
        if (!isMatch) {
          continue;
        }
      }
      Id.NamespacedId targetId=MdsValueKey.getNamespaceIdFromKey(targetType,rowKey);
      String key=MdsValueKey.getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(MetadataDataset.VALUE_COLUMN)));
      MetadataEntry entry=new MetadataEntry(targetId,key,value);
      results.add(entry);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}