Program: 33238
Project: 33238
Buggy source:
private void handleActionDispatching(final ODataRequest request,final ODataResponse response,final UriResourceAction uriResourceAction) throws ODataApplicationException, ODataLibraryException {
  final EdmAction action=uriResourceAction.getAction();
  if (action.isBound()) {
    validatePreconditions(request,false);
  }
  final EdmReturnType returnType=action.getReturnType();
  final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
  checkContentTypeSupport(requestFormat,RepresentationType.ACTION_PARAMETERS);
  if (returnType == null) {
    handler.selectProcessor(ActionVoidProcessor.class).processActionVoid(request,response,uriInfo,requestFormat);
  }
 else {
    final boolean isCollection=returnType.isCollection();
    ContentType responseFormat;
switch (returnType.getType().getKind()) {
case ENTITY:
      responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_ENTITY : RepresentationType.ENTITY);
    if (isCollection) {
      handler.selectProcessor(ActionEntityCollectionProcessor.class).processActionEntityCollection(request,response,uriInfo,requestFormat,responseFormat);
    }
 else {
      handler.selectProcessor(ActionEntityProcessor.class).processActionEntity(request,response,uriInfo,requestFormat,responseFormat);
    }
  break;
case PRIMITIVE:
responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_PRIMITIVE : RepresentationType.PRIMITIVE);
if (isCollection) {
handler.selectProcessor(ActionPrimitiveCollectionProcessor.class).processActionPrimitiveCollection(request,response,uriInfo,requestFormat,responseFormat);
}
 else {
handler.selectProcessor(ActionPrimitiveProcessor.class).processActionPrimitive(request,response,uriInfo,requestFormat,responseFormat);
}
break;
case COMPLEX:
responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_COMPLEX : RepresentationType.COMPLEX);
if (isCollection) {
handler.selectProcessor(ActionComplexCollectionProcessor.class).processActionComplexCollection(request,response,uriInfo,requestFormat,responseFormat);
}
 else {
handler.selectProcessor(ActionComplexProcessor.class).processActionComplex(request,response,uriInfo,requestFormat,responseFormat);
}
break;
default :
throw new ODataHandlerException("String_Node_Str",ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
}

Fixed version (ground truth):
private void handleActionDispatching(final ODataRequest request,final ODataResponse response,final UriResourceAction uriResourceAction) throws ODataApplicationException, ODataLibraryException {
  final EdmAction action=uriResourceAction.getAction();
  if (action.isBound()) {
    validatePreconditions(request,false);
  }
  final EdmReturnType returnType=action.getReturnType();
  final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
  checkContentTypeSupport(requestFormat,RepresentationType.ACTION_PARAMETERS);
  if (returnType == null) {
    handler.selectProcessor(ActionVoidProcessor.class).processActionVoid(request,response,uriInfo,requestFormat);
  }
 else {
    final boolean isCollection=returnType.isCollection();
    ContentType responseFormat;
switch (returnType.getType().getKind()) {
case ENTITY:
      responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_ENTITY : RepresentationType.ENTITY);
    if (isCollection) {
      handler.selectProcessor(ActionEntityCollectionProcessor.class).processActionEntityCollection(request,response,uriInfo,requestFormat,responseFormat);
    }
 else {
      handler.selectProcessor(ActionEntityProcessor.class).processActionEntity(request,response,uriInfo,requestFormat,responseFormat);
    }
  break;
case PRIMITIVE:
responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_PRIMITIVE : RepresentationType.PRIMITIVE);
if (isCollection) {
handler.selectProcessor(ActionPrimitiveCollectionProcessor.class).processActionPrimitiveCollection(request,response,uriInfo,requestFormat,responseFormat);
}
 else {
handler.selectProcessor(ActionPrimitiveProcessor.class).processActionPrimitive(request,response,uriInfo,requestFormat,responseFormat);
}
break;
case COMPLEX:
responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),isCollection ? RepresentationType.COLLECTION_COMPLEX : RepresentationType.COMPLEX);
if (isCollection) {
handler.selectProcessor(ActionComplexCollectionProcessor.class).processActionComplexCollection(request,response,uriInfo,requestFormat,responseFormat);
}
 else {
handler.selectProcessor(ActionComplexProcessor.class).processActionComplex(request,response,uriInfo,requestFormat,responseFormat);
}
break;
default :
throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
}