stklcode opened a new pull request, #14043:
URL: https://github.com/apache/camel/pull/14043
# Description
Generation of string representation for arrays relies on getName() as a
workaround to properly support nested classes. However, this results in
"null[]" for array of primitives.
```java
package my.example;
public class MyRoutes extends org.apache.camel.builder.RouteBuilder {
@Override
public void configure() throws Exception {
rest()
.get("/test")
.outType(byte[].class) // <-- this is the problematic
argument
.produces("application/octet-stream")
.route()
.log("test me");
}
}
```
The problem is that `asTypeName(byte[].class)` returns `"null[]"` before
this fix, because `byte[].class.getName()` equals `"[B"` and the logic is
looking for `"[L...;"` only.
Rework (and simplify) the logic and introduce a unit test, so we can handle
such types properly again.
# Target
- [x] I checked that the commit is targeting the correct branch (note that
Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for
the change (usually before you start working on it).
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful
subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally and I have
committed all auto-generated changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]