-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String.replace() errornous compares and replaces one byte instead of two bytes #19903
Comments
Workaround: |
pshipton
added this to the Release 0.46 (Java 8, 11, 17, 21, 22) July refresh milestone
Jul 23, 2024
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
Does not occur with this input (added brackets): TEST_STRING.replaceAll( "[\u1161]", "[" ); |
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
I expect the test intended to start with the same string for both paths: final String replacedWithPattern = LEFT_BRACKET_PATTERN.matcher(TEST_STRING).replaceAll("["); The difference is that it shows that |
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
pshipton
added a commit
to pshipton/openj9
that referenced
this issue
Jul 23, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
The fixes to head, 0.46, 0.47 are merged. |
Thank you so much for this quick fix!!! 👍🏻 |
tajila
pushed a commit
to tajila/openj9
that referenced
this issue
Jul 30, 2024
Also, return the original String in the fast paths when nothing is replaced. Issue eclipse-openj9#19903 Signed-off-by: Peter Shipton <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
given this sample program:
Our developer expects this program to output a copy of the string, but in fact, all "a" characters get replaced. This is highly unexpected and dangerous.
Also confirmed with JDK11 build 20240723-095802 on Mac from OpenJ9 jenkins.
Case number: TS016798420
The text was updated successfully, but these errors were encountered: