oscerd opened a new pull request, #25998: URL: https://github.com/apache/camel/pull/25998
## Issue [CAMEL-24541](https://issues.apache.org/jira/browse/CAMEL-24541) ## Problem `ImageNetUtil.extractClassName` parses the winning classification with: ```java String className = body.best().getClassName().split(",")[0].split(" ", 2)[1]; ``` It assumes every class name has the ImageNet `"<id> <label>"` shape (e.g. `n01440764 tench, Tinca tinca`). A class name without a space — a bare id, a custom label, or a malformed synset entry — makes `split(" ", 2)` return a single-element array, so `[1]` throws `ArrayIndexOutOfBoundsException`. ## Fix Guard on the split length and fall back to the whole token when there is no space, so a class name that does not match the expected shape no longer crashes the route. ## Testing - New `ImageNetUtilTest` covers a normal ImageNet class name (extracts the label) and a class name with no space (no exception, returns the token). - `mvn -Psourcecheck validate` green. _Claude Code on behalf of oscerd_ -- 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]
