Program: 33236
Project: 33236
Buggy source:
private void handleValueDispatching(final ODataRequest request,final ODataResponse response,final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
  final HttpMethod method=request.getMethod();
  final UriResource resource=uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
  if (resource instanceof UriResourceProperty || resource instanceof UriResourceFunction && ((UriResourceFunction)resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
    final EdmType type=resource instanceof UriResourceProperty ? ((UriResourceProperty)resource).getType() : ((UriResourceFunction)resource).getType();
    final RepresentationType valueRepresentationType=type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ? RepresentationType.BINARY : RepresentationType.VALUE;
    if (method == HttpMethod.GET) {
      final ContentType requestedContentType=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),valueRepresentationType);
      handler.selectProcessor(PrimitiveValueProcessor.class).readPrimitiveValue(request,response,uriInfo,requestedContentType);
    }
 else     if (method == HttpMethod.PUT && resource instanceof UriResourceProperty) {
      validatePreconditions(request,false);
      final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
      checkContentTypeSupport(requestFormat,valueRepresentationType);
      final ContentType responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),valueRepresentationType);
      handler.selectProcessor(PrimitiveValueProcessor.class).updatePrimitiveValue(request,response,uriInfo,requestFormat,responseFormat);
    }
 else     if (method == HttpMethod.DELETE && resource instanceof UriResourceProperty) {
      validatePreconditions(request,false);
      handler.selectProcessor(PrimitiveValueProcessor.class).deletePrimitiveValue(request,response,uriInfo);
    }
 else {
      throw new ODataHandlerException("String_Node_Str" + method + "String_Node_Str",ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED,method.toString());
    }
  }
 else {
    if (method == HttpMethod.GET) {
      final ContentType requestedContentType=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),RepresentationType.MEDIA);
      handler.selectProcessor(MediaEntityProcessor.class).readMediaEntity(request,response,uriInfo,requestedContentType);
    }
 else     if (method == HttpMethod.PUT && resource instanceof UriResourceEntitySet) {
      validatePreconditions(request,true);
      final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
      final ContentType responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),RepresentationType.ENTITY);
      handler.selectProcessor(MediaEntityProcessor.class).updateMediaEntity(request,response,uriInfo,requestFormat,responseFormat);
    }
 else     if (method == HttpMethod.DELETE && resource instanceof UriResourceEntitySet) {
      validatePreconditions(request,true);
      handler.selectProcessor(MediaEntityProcessor.class).deleteMediaEntity(request,response,uriInfo);
    }
 else {
      throw new ODataHandlerException("String_Node_Str" + method + "String_Node_Str",ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED,method.toString());
    }
  }
}

Fixed version (ground truth):
private void handleValueDispatching(final ODataRequest request,final ODataResponse response,final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
  final HttpMethod method=request.getMethod();
  final UriResource resource=uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
  if (resource instanceof UriResourceProperty || resource instanceof UriResourceFunction && ((UriResourceFunction)resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
    final EdmType type=resource instanceof UriResourceProperty ? ((UriResourceProperty)resource).getType() : ((UriResourceFunction)resource).getType();
    final RepresentationType valueRepresentationType=type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ? RepresentationType.BINARY : RepresentationType.VALUE;
    if (method == HttpMethod.GET) {
      final ContentType requestedContentType=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),valueRepresentationType);
      handler.selectProcessor(PrimitiveValueProcessor.class).readPrimitiveValue(request,response,uriInfo,requestedContentType);
    }
 else     if (method == HttpMethod.PUT && resource instanceof UriResourceProperty) {
      validatePreconditions(request,false);
      final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
      checkContentTypeSupport(requestFormat,valueRepresentationType);
      final ContentType responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),valueRepresentationType);
      handler.selectProcessor(PrimitiveValueProcessor.class).updatePrimitiveValue(request,response,uriInfo,requestFormat,responseFormat);
    }
 else     if (method == HttpMethod.DELETE && resource instanceof UriResourceProperty) {
      validatePreconditions(request,false);
      handler.selectProcessor(PrimitiveValueProcessor.class).deletePrimitiveValue(request,response,uriInfo);
    }
 else {
      throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED,method.toString());
    }
  }
 else {
    if (method == HttpMethod.GET) {
      final ContentType requestedContentType=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),RepresentationType.MEDIA);
      handler.selectProcessor(MediaEntityProcessor.class).readMediaEntity(request,response,uriInfo,requestedContentType);
    }
 else     if (method == HttpMethod.PUT && resource instanceof UriResourceEntitySet) {
      validatePreconditions(request,true);
      final ContentType requestFormat=ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
      final ContentType responseFormat=ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),request,handler.getCustomContentTypeSupport(),RepresentationType.ENTITY);
      handler.selectProcessor(MediaEntityProcessor.class).updateMediaEntity(request,response,uriInfo,requestFormat,responseFormat);
    }
 else     if (method == HttpMethod.DELETE && resource instanceof UriResourceEntitySet) {
      validatePreconditions(request,true);
      handler.selectProcessor(MediaEntityProcessor.class).deleteMediaEntity(request,response,uriInfo);
    }
 else {
      throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED,method.toString());
    }
  }
}