Closed sirf closed 3 years ago
/cc @mkouba
FYI I just realized it's not even necessary to modify any parameter in order to trigger the issue.
This is enough to cause the app to crash.
context.setParameters(context.getParameters());
A workaround is of course to change the signature of the intercepted method to accept Integer instead of int, etc.
Yes, we need to box the primitive method parameter types during validation because the params are represented as Object[]
.
@sirf Would you care to send a PR or should I fix it? FYI there's a util method that can be used here: https://github.com/quarkusio/quarkus/blob/main/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Types.java#L20-L26
@mkouba I'll give it a shot.
Describe the bug
When an @AroundInvoke interceptor is used on a method that accepts one or many arguments with primitive types, and one of the arguments are modified, the application crashes with an IllegalArgumentException.
Expected behavior
Should not crash.
Actual behavior
Crashes.
To Reproduce
I've attached a simple reproducer. It's just the getting-started-reactive project with the addition of a simple interceptor that attempts to change the first argument to the intercepted method. getting-started-reactive.tar.gz
The interceptor is applied to this method in ReactiveGreetingService
and the bug is triggered by GET http://localhost:8080/hello/greeting/10/johan after starting the app in dev mode.
NOTE The application will crash with the exact same error even if the int-argument is left untouched, e.g. if we remove
params[0] = 3
and instead try to doparams[1] = "johan"
Environment
Output of
java -version
openjdk version "14.0.2" 2020-07-14 OpenJDK Runtime Environment (build 14.0.2+12-Ubuntu-1) OpenJDK 64-Bit Server VM (build 14.0.2+12-Ubuntu-1, mixed mode, sharing)
Quarkus version or git rev
1.13.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)pache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /home/.../.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3 Java version: 14.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-14-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.8.0-45-generic", arch: "amd64", family: "unix"