davsclaus opened a new pull request, #26984: URL: https://github.com/apache/camel/pull/26984
Fixes [CAMEL-25084](https://issues.apache.org/jira/browse/CAMEL-25084): bugs found in a deep review of the camel-util helpers, and their callers in camel-support. ## Fixed 1. `URISupport.createQueryString` writes an extra `&` for an empty list value. 2. `URISupport.parseQuery` adds a parameter with an empty name for `&&`, which gave a cryptic `Index 0 out of bounds` error when creating the endpoint. 3. `FileUtil.stripExt("/.bashrc")` returned `/`. 4. `FileUtil.compactPath("C:/a/../../b")` dropped the Windows drive. 5. `IOHelper.getCharsetNameFromContentType` matched `mycharset=`. 6. `IOHelper.EncodingInputStream` turned a surrogate pair split at its buffer end into `??`. 7. `TimeUtils.toMilliSeconds` silently returned 0 or a partial value for an invalid time pattern, so `period=five` became 0 and `period=1m30` became 60000. Upper case units (`5S`) now work, a negative pattern (`-5s`) now stays negative, and invalid values are now rejected. 8. A time pattern too large for an `int` option no longer overflows to a negative number (`PropertyConfigurerSupport`, `LanguageSupport`). 9. `Scanner.hasNext()` returned true and then `next()` threw when a growing delimiter was split at the buffer end (tokenize with `regex=true`). 10. `StringHelper.normalizeWhitespace` (the Simple `${normalizeWhitespace()}` function) left tabs, new lines and mixed whitespace alone. 11. `EndpointUriFactorySupport.buildPathParameter` replaced the wrong text when a path parameter name is part of another name: `knative:type/typeId` built `knative:type/channelId`. It also treated the value as a regex replacement. `StringHelper.replaceFromSecondOccurrence` had the same regex problem and replaced only every other occurrence. 12. `StringHelper.dashToCamelCase` stopped protecting `[...]` keys after a quoted section. 13. `StringHelper.removeStartingCharacters` threw for an empty text or one made only of the character (such as `jms:queue:/`). 14. `BackOffTimerTask`: the delay grew above `maxDelay`, and after `reset()` every delay was 0. 15. `ObjectHelper.getException` looped forever when the cause chain has a cycle. 16. `ObjectHelper.loadClass` could not load `int[]`, `Integer[]` or `String[][]`. 17. `AnnotationHelper.findMethodsWithAnnotation` also returned bridge methods and overridden super class methods. 18. `ThreadPoolRejectedPolicy.Block` silently dropped a task when the pool was shut down. The upgrade guide has entries for the stricter time patterns (7, 8) and for `normalizeWhitespace` (10). ## Not changed - `URISupport.normalizeUri` does not always give the same URI when run a second time (a follow-up to CAMEL-24524). Fixing it changes the encoding of existing endpoint URIs, so it needs its own decision. - `StringQuoteHelper.splitSafeQuote` trimming: the file is changed by CAMEL-25081 (#26977). - `BaseOrderedProperties` has missing overrides; the fix also needs a change in camel-main, so it will have its own ticket. - The camel-support `ObjectHelper` fixes are in CAMEL-25083 (#26983). ## Tests - New `UtilEdgeCasesTest` (camel-util, 19 tests) and `EndpointOptionEdgeCasesTest` (camel-core, 4 tests). All of them fail without the fix. - camel-util: 275 tests pass. - camel-core: full suite run. The only failures were the resequencer and file cluster tests, because the build used camel-core-processor and camel-file jars in `~/.m2` that predate CAMEL-25053 and CAMEL-25052. They pass when run with `-am`. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
