CAMEL-22409: zwsp invisible character breaks property at runtime#22281
CAMEL-22409: zwsp invisible character breaks property at runtime#22281claudio4j wants to merge 1 commit intoapache:mainfrom
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
Good fix for a real user-facing bug — the {zwsp} (Zero-Width Space) character silently breaking copy-pasted property names is nasty to debug.
One observation (non-blocking): with "" as separator, getShortName(int) is now effectively a no-op. Here's why:
wrapCamelCaseWordssplits camelCase into space-separated words viareplaceAll("(?=[A-Z][a-z])", " "), e.g."camel.main.auto Configuration Enabled"wrapWordsreassembles them, insertinglineSepat word boundaries past the watermark- With
lineSep="", those insertions are empty — the words just concatenate back to the original string wrapCamelCaseWordsuppercases the first char, thengetShortNamelowercases it back — cancelling out
So the method does real work (regex, word wrapping, case conversion) but it's all a round-trip back to the original name. Could be simplified to return name; in a follow-up if desired.
Claude Code on behalf of Guillaume Nodet
| String text = Strings.wrapCamelCaseWords(name, watermark, ""); | ||
| // ensure the option name starts with lower-case | ||
| return Character.toLowerCase(text.charAt(0)) + text.substring(1); |
There was a problem hiding this comment.
With "" as separator, wrapCamelCaseWords splits camelCase into words and joins them back unchanged, and the uppercase/lowercase operations cancel each other out — making this method a no-op.
| String text = Strings.wrapCamelCaseWords(name, watermark, ""); | |
| // ensure the option name starts with lower-case | |
| return Character.toLowerCase(text.charAt(0)) + text.substring(1); | |
| return name; |
The method itself (and the watermark parameter) could be removed entirely in a follow-up PR, replacing row.getShortName(30) with row.name in the two MVEL templates (main-options.mvel and jbang-options.mvel).
Claude Code on behalf of Guillaume Nodet
There was a problem hiding this comment.
Can you clarify where is the uppercase happening and why it is cancelling it out?
There was a problem hiding this comment.
wrapCamelCaseWords in Strings.java:55 uppercases the first character:
text = Character.toUpperCase(text.charAt(0)) + text.substring(1);Then getShortName in BaseOptionModel.java:349 lowercases it right back:
return Character.toLowerCase(text.charAt(0)) + text.substring(1);Since property names already start with lowercase (e.g. camel.main.autoConfigurationEnabled), it's c → C → c — a round-trip back to the original.
Claude Code on behalf of Guillaume Nodet
apupier
left a comment
There was a problem hiding this comment.
I do not understand all the side-effect that this could have.
These {zwsp} were introduced to fix this problem https://issues.apache.org/jira/browse/CAMEL-13923 is it still working fine?
also I notice that previously it was Strings.wrapCamelCaseWords(name, watermark, " "); and not Strings.wrapCamelCaseWords(name, watermark, "");
This is why the change is putting the whole name in a single camel case name and not with a space in it, right?
This invisible character was used to split the word in tables, right? If I understand well, we will need to have apache/camel-website#1549 to have it split correctly? I was unable to navigate to the page showing thsi kind of content with the netlify link (```This file exists solely to defeat the limitations of the link checker, that is unaware of the .htaccess redirect from this page to the latest released version.
If you see this, you are not viewing the site through httpd or there is something wrong with the .htaccess file: in the latter case please let the camel developers know.
Do you have some screenshots from local usage? or a direct link to the correct place to look at please?
tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/BaseOptionModel.java
Outdated
Show resolved
Hide resolved
|
Having the mvel templates to use the row.name to set the full property name and the css in camel-website takes care to word wrap the long property names in the rendered html. |
the actual issue with the zwsp is better described in CAMEL-22409 about copy/paste.
yes, the css will word wrap the long property names. |
Description
There is an incoming PR to camel-website css that's going to break words when there is a long property name.
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.