Program: 18135
Project: 18135
Buggy source:
private ArrayList<KeyPredicate> parseKey(final String keyPredicate,final EdmEntityType entityType) throws UriParserException, EdmException {
  ArrayList<KeyPredicate> keyPredicates=new ArrayList<KeyPredicate>();
  List<EdmProperty> keyProperties=entityType.getKeyProperties();
  final boolean singleKey=keyProperties.size() == 1;
  for (  final String key : keyPredicate.split("String_Node_Str")) {
    final Matcher matcher=NAMED_VALUE_PATTERN.matcher(key);
    if (!matcher.matches())     throw new UriParserException("String_Node_Str" + key);
    String name=matcher.group(1);
    final String value=matcher.group(2);
    UriParser.LOG.debug("String_Node_Str" + keyPredicate + "String_Node_Str"+ name+ "String_Node_Str"+ value);
    if (name == null)     if (singleKey)     name=keyProperties.get(0).getName();
 else     throw new UriParserException("String_Node_Str" + keyPredicate);
    EdmProperty keyProperty=null;
    for (    EdmProperty testKeyProperty : keyProperties)     if (testKeyProperty.getName().equals(name)) {
      keyProperty=testKeyProperty;
      break;
    }
    if (keyProperty == null)     throw new UriParserException("String_Node_Str" + keyPredicate);
    keyProperties.remove(keyProperty);
    final UriLiteral uriLiteral=parseUriLiteral(value);
    if (!isCompatible(uriLiteral,(EdmSimpleType)keyProperty.getType()))     throw new UriParserException("String_Node_Str" + value + "String_Node_Str"+ keyProperty.getName());
    keyPredicates.add(new KeyPredicate(uriLiteral.getLiteral(),keyProperty));
  }
  if (!keyProperties.isEmpty())   throw new UriParserException("String_Node_Str" + keyPredicate);
  return keyPredicates;
}

Fixed version (ground truth):
private ArrayList<KeyPredicate> parseKey(final String keyPredicate,final EdmEntityType entityType) throws UriParserException, EdmException {
  final List<EdmProperty> keyProperties=entityType.getKeyProperties();
  ArrayList<EdmProperty> parsedKeyProperties=new ArrayList<EdmProperty>();
  ArrayList<KeyPredicate> keyPredicates=new ArrayList<KeyPredicate>();
  for (  final String key : keyPredicate.split("String_Node_Str",-1)) {
    final Matcher matcher=NAMED_VALUE_PATTERN.matcher(key);
    if (!matcher.matches())     throw new UriParserException("String_Node_Str" + key);
    String name=matcher.group(1);
    final String value=matcher.group(2);
    UriParser.LOG.debug("String_Node_Str" + keyPredicate + "String_Node_Str"+ name+ "String_Node_Str"+ value);
    if (name == null)     if (keyProperties.size() == 1)     name=keyProperties.get(0).getName();
 else     throw new UriParserException("String_Node_Str" + keyPredicate);
    EdmProperty keyProperty=null;
    for (    final EdmProperty testKeyProperty : keyProperties)     if (testKeyProperty.getName().equals(name)) {
      keyProperty=testKeyProperty;
      break;
    }
    if (keyProperty == null)     throw new UriParserException(name + "String_Node_Str");
    if (parsedKeyProperties.contains(keyProperty))     throw new UriParserException("String_Node_Str" + keyPredicate);
    parsedKeyProperties.add(keyProperty);
    final UriLiteral uriLiteral=parseUriLiteral(value);
    if (!isCompatible(uriLiteral,(EdmSimpleType)keyProperty.getType()))     throw new UriParserException("String_Node_Str" + value + "String_Node_Str"+ keyProperty.getName());
    keyPredicates.add(new KeyPredicate(uriLiteral.getLiteral(),keyProperty));
  }
  if (parsedKeyProperties.size() != keyProperties.size())   throw new UriParserException("String_Node_Str" + keyPredicate);
  return keyPredicates;
}