Program: 189723
Project: 189723
Buggy source:
/** 
 * Parses the Parameter Annotations Literal Values
 * @param parameterName The name of the Parameter
 * @param functionArgumentName The name of the Function Argument
 * @param defaultValue The default value if provided, or null otherwise
 * @return A description of the mapping between the Parameter and the Function Argument
 * @throws RestAnnotationException if the mapping is invalid
 */
protected ParameterAnnotationMapping parseAnnotationLiterals(final Literal parameterName,final Literal functionArgumentName,final Literal defaultValue) throws RestAnnotationException {
  if (parameterName.getType() != Type.STRING) {
    throw new RestAnnotationException(getInvalidParameterNameErr());
  }
  if (functionArgumentName.getType() != Type.STRING) {
    throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
  }
  if (defaultValue != null && !defaultValue.getType().isSubTypeOf(Type.ANY_SIMPLE_TYPE)) {
    throw new RestAnnotationException(getInvalidDefaultValueErr());
  }
  final String keyStr=parameterName.getValue();
  final String varStr=functionArgumentName.getValue();
  if (keyStr.isEmpty()) {
    throw new RestAnnotationException(getInvalidParameterNameErr());
  }
  if (varStr.isEmpty()) {
    throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
  }
  final Matcher mtcFnParameter=functionArgumentPattern.matcher(varStr);
  if (!mtcFnParameter.matches()) {
    throw new RestAnnotationException(getInvalidAnnotationParametersSyntaxErr());
  }
  final String varName=mtcFnParameter.group(1);
  if (defaultValue == null) {
    checkFnDeclaresParameter(getFunctionSignature(),varName);
  }
 else {
    checkFnDeclaresParameterWithType(getFunctionSignature(),varName,defaultValue.getType(),getInvalidDefaultValueTypeErr());
  }
  return new ParameterAnnotationMapping(keyStr,varName,defaultValue != null ? defaultValue : null);
}

Fixed version (ground truth):
/** 
 * Parses the Parameter Annotations Literal Values
 * @param parameterName The name of the Parameter
 * @param functionArgumentName The name of the Function Argument
 * @param defaultValue The default value if provided, or null otherwise
 * @return A description of the mapping between the Parameter and the Function Argument
 * @throws RestAnnotationException if the mapping is invalid
 */
protected final ParameterAnnotationMapping parseAnnotationLiterals(final Literal parameterName,final Literal functionArgumentName,final Cardinality requiredCardinality) throws RestAnnotationException {
  if (parameterName.getType() != Type.STRING) {
    throw new RestAnnotationException(getInvalidParameterNameErr());
  }
  if (functionArgumentName.getType() != Type.STRING) {
    throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
  }
  final String keyStr=parameterName.getValue();
  final String varStr=functionArgumentName.getValue();
  if (keyStr.isEmpty()) {
    throw new RestAnnotationException(getInvalidParameterNameErr());
  }
  if (varStr.isEmpty()) {
    throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
  }
  final Matcher mtcFnParameter=functionArgumentPattern.matcher(varStr);
  if (!mtcFnParameter.matches()) {
    throw new RestAnnotationException(getInvalidAnnotationParametersSyntaxErr());
  }
  final String varName=mtcFnParameter.group(1);
  checkFnDeclaresParameter(getFunctionSignature(),varName,requiredCardinality);
  return new ParameterAnnotationMapping(keyStr,varName);
}