Assumptions
There is an endpoint with byte[] parameter. E.g. photo parameter in following snippet.
// byte[] parameter
@RequestLine("POST /send_photo")
@Headers("Content-Type: multipart/form-data")
void sendPhoto (@Param("is_public") Boolean isPublic, @Param("photo") byte[] photo);
The sendPhoto() method is called.
Issue
The AbstractFormWriter.isTypeOrCollection() tries to cast the byte[] value into Object[] which leads to the "java.lang.ClassCastException: class [B cannot be cast to class [Ljava.lang.Object; ([B and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')" error.
Problem is on the line 65: https://github.com/spring-cloud/spring-cloud-openfeign/blob/10ad8a0c6ea0a5b641eb31318c93055bdaf4c4f8/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/AbstractFormWriter.java#L63-L65
Expected behaviour
The method should be able to handle arrays of primitive types without casting into Object[].
FYI: @darrenfoong
Comment From: OlgaMaciaszek
Hello @vkuzel , looks like a bug. Thanks for reporting it.