Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Failed to upload blob: Wrong number of arguments; expected 1, got 0 #40715

Closed
3 tasks
peter6053 opened this issue Jun 19, 2024 · 6 comments · Fixed by #40719
Closed
3 tasks

[BUG] Failed to upload blob: Wrong number of arguments; expected 1, got 0 #40715

peter6053 opened this issue Jun 19, 2024 · 6 comments · Fixed by #40719
Assignees
Labels
Azure.Core azure-core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@peter6053
Copy link

Describe the bug
Am trying to upload a n image
Exception or Stack Trace
Add the exception log and stack trace if available
E Failed to upload blob: Wrong number of arguments; expected 1, got 0
java.lang.IllegalArgumentException: Wrong number of arguments; expected 1, got 0
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at com.azure.core.implementation.ConstructorReflectiveInvoker.invokeWithArguments(ConstructorReflectiveInvoker.java:24)
at com.azure.core.implementation.jackson.ObjectMapperShim.deserialize(ObjectMapperShim.java:336)
at com.azure.core.util.serializer.JacksonAdapter.lambda$deserialize$11$com-azure-core-util-serializer-JacksonAdapter(JacksonAdapter.java:453)
at com.azure.core.util.serializer.JacksonAdapter$$ExternalSyntheticLambda9.call(Unknown Source:6)
at com.azure.core.util.serializer.JacksonAdapter.useAccessHelper(JacksonAdapter.java:484)
at com.azure.core.util.serializer.JacksonAdapter.deserialize(JacksonAdapter.java:453)
at com.azure.core.implementation.serializer.HttpResponseHeaderDecoder.decode(HttpResponseHeaderDecoder.java:39)
at com.azure.core.implementation.serializer.HttpResponseDecoder$HttpDecodedResponse.getDecodedHeaders(HttpResponseDecoder.java:107)
at com.azure.core.implementation.http.rest.RestProxyBase.createResponse(RestProxyBase.java:185)
at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$handleRestResponseReturnType$5$com-azure-core-implementation-http-rest-AsyncRestProxy(AsyncRestProxy.java:149)
at com.azure.core.implementation.http.rest.AsyncRestProxy$$ExternalSyntheticLambda11.call(Unknown Source:6)
at reactor.core.publisher.MonoCallable.call(MonoCallable.java:92)
To Reproduce
Steps to reproduce the behavior:
Have Android Studio Flamingo | 2022.2.1 Patch 2 install try to upload an image
Code Snippet
Add the code snippet that causes the issue.
try {
// Using the correct upload method
blobClient.upload(imageStream, imageByteArray.size.toLong(), true)
val imageUrl = blobClient.blobUrl
Log.d("Upload Success", "Uploaded to: $imageUrl")
runOnUiThread {
Toast.makeText(this@IssueParcelActivity, "Uploaded to: $imageUrl", Toast.LENGTH_LONG).show()
}
}
Expected behavior
A clear and concise description of what you expected to happen.
the response should say Failed to upload blob: Wrong number of arguments; expected 1, got 0
java.lang.IllegalArgumentException: Wrong number of arguments; expected 1, got 0
Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [e.g. iOS] mac os
  • IDE: [e.g. IntelliJ]Have Android Studio Flamingo | 2022.2.1 Patch 2
  • Library/Libraries: implementation "com.azure:azure-storage-blob:12.25.2"
  • Java version: 11
  • App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]
  • Frameworks: [e.g. Spring Boot, Micronaut, Quarkus, etc] kotlin

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files) labels Jun 19, 2024
Copy link

Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@alzimmermsft alzimmermsft added Azure.Core azure-core and removed Storage Storage Service (Queues, Blobs, Files) labels Jun 19, 2024
@alzimmermsft
Copy link
Member

Thanks for filing this issue @peter6053.

Unassigning @ibrahimrabab as this is an issue with azure-core.

Looks like this is a case where a few locations within azure-core calls into the incorrect APIs for reflectively creating objects and calling static methods. Using invokeWithArguments rather than invokeStatic and the java.lang.invoke implementations worked as they need to handle Object target, Object... args differently than the java.lang.reflect implementations.

@peter6053
Copy link
Author

peter6053 commented Jun 21, 2024 via email

@alzimmermsft
Copy link
Member

Hi @peter6053, the issue was with how we were performing reflective calls when in an environment that doesn't have the java.lang.invoke package, a common case for Android, and when we fall back to using java.lang.reflect. There was an issue where the arguments used to reflectively invoke constructors and static methods were being consumed incorrectly, leading to the exception you are seeing.

The fix will be available sometime in early July when we release our libraries again.

@peter6053
Copy link
Author

peter6053 commented Jun 25, 2024 via email

@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core azure-core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants