Program: 189696
Project: 189696
Buggy source:
/** 
 * Extract Annotated Parameters from the Request
 * @param request The HTTP Request to process
 * @return The Map of Parameters to values, the key is the parametername and the value is the sequence of values extracted from the request
 * @throws RestXqServiceException If an error occurred whilst processing the request
 */
protected Set<TypedArgumentValue> extractParameters(final HttpRequest request) throws RestXqServiceException {
  final Set<TypedArgumentValue> paramNameValues=new HashSet<TypedArgumentValue>();
  if (getResourceFunction().getPathAnnotation() != null) {
    for (    final Entry<String,String> pathParameter : getResourceFunction().getPathAnnotation().extractPathParameters(request.getPath()).entrySet()) {
      paramNameValues.add(new TypedArgumentValue<String>(){
        @Override public String getArgumentName(){
          return pathParameter.getKey();
        }
        @Override public Sequence<String> getTypedValue(){
          return new SequenceImpl<String>(new StringTypedValue(pathParameter.getValue()));
        }
      }
);
    }
  }
  if (!getBodyContentAnnotations().isEmpty()) {
    final Sequence requestBody=extractRequestBody(request);
    for (    final HttpMethodWithBodyAnnotation bodyContentAnnotation : getBodyContentAnnotations()) {
      paramNameValues.add(new TypedArgumentValue(){
        @Override public String getArgumentName(){
          return bodyContentAnnotation.getBodyParameterName();
        }
        @Override public Sequence getTypedValue(){
          return requestBody;
        }
      }
);
    }
  }
  for (  final ParameterAnnotation parameterAnnotation : getResourceFunction().getParameterAnnotations()) {
    final TypedArgumentValue typedArgumentValue=parameterAnnotation.extractParameter(request);
    paramNameValues.add(new TypedArgumentValue(){
      @Override public String getArgumentName(){
        return typedArgumentValue.getArgumentName();
      }
      @Override public Sequence getTypedValue(){
        return typedArgumentValue.getTypedValue();
      }
    }
);
  }
  return paramNameValues;
}

Fixed version (ground truth):
/** 
 * Extract Annotated Parameters from the Request
 * @param request The HTTP Request to process
 * @return The Map of Parameters to values, the key is the parametername and the value is the sequence of values extracted from the request
 * @throws RestXqServiceException If an error occurred whilst processing the request
 */
protected Set<TypedArgumentValue> extractParameters(final HttpRequest request) throws RestXqServiceException {
  final Set<TypedArgumentValue> paramNameValues=new HashSet<TypedArgumentValue>();
  if (getResourceFunction().getPathAnnotation() != null) {
    for (    final Entry<String,String> pathParameter : getResourceFunction().getPathAnnotation().extractPathParameters(request.getPath()).entrySet()) {
      paramNameValues.add(new TypedArgumentValue<String>(){
        @Override public String getArgumentName(){
          return pathParameter.getKey();
        }
        @Override public Sequence<String> getTypedValue(){
          return new SequenceImpl<String>(new StringTypedValue(pathParameter.getValue()));
        }
      }
);
    }
  }
  if (!getBodyContentAnnotations().isEmpty()) {
    final Sequence requestBody=extractRequestBody(request);
    for (    final HttpMethodWithBodyAnnotation bodyContentAnnotation : getBodyContentAnnotations()) {
      paramNameValues.add(new TypedArgumentValue(){
        @Override public String getArgumentName(){
          return bodyContentAnnotation.getBodyParameterName();
        }
        @Override public Sequence getTypedValue(){
          if (requestBody != null) {
            return requestBody;
          }
 else {
            return Sequence.EMPTY_SEQUENCE;
          }
        }
      }
);
    }
  }
  for (  final ParameterAnnotation parameterAnnotation : getResourceFunction().getParameterAnnotations()) {
    final TypedArgumentValue typedArgumentValue=parameterAnnotation.extractParameter(request);
    paramNameValues.add(new TypedArgumentValue(){
      @Override public String getArgumentName(){
        return typedArgumentValue.getArgumentName();
      }
      @Override public Sequence getTypedValue(){
        return typedArgumentValue.getTypedValue();
      }
    }
);
  }
  return paramNameValues;
}