apache / apache/jmeter

Use unicode invariant locale in __changeCase function

Open
#5,723 0 comments 0 reactions 0 assignees View on GitHub
enhancement to-triage
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

### Use case

`__changeCase` was introduced in https://github.com/apache/jmeter/issues/4587, and it uses locale-dependent conversion. It makes it prone to errors.

Kotlin recently switched to invariant locale when the user provides no locale: https://youtrack.jetbrains.com/issue/KT-43023
In other words, `"i".uppercase()` yields `I` even in tr_TR locale.

Currently `org.apache.jmeter.functions.ChangeCaseSpec` fails in `tr_TR` locale as follows:

```
FAILURE 0,4sec, org.apache.jmeter.functions.ChangeCaseSpec > convert 'simple' using mode upper to 'SIMPLE'
Condition not satisfied:

output == changeCase.execute(result, null)
| | | | |
SIMPLE | | S?MPLE org.apache.jmeter.samplers.SampleResult@7cbebcbf
|
false
1 difference (83% similarity)
S(I)MPLE
S(?)MPLE
```

### Possible solution

Add an extra parameter to `__changeCase` so the user can specify the locale. A special value of `default` could designate `Locale.getDefault()`.

### Possible workarounds

Skip `ChangeCaseSpec` in `tr_TR` locale.

### JMeter Version

5.5

### Java Version

_No response_

### OS Version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with org.apache.jmeter.functions.ChangeCaseSpec and the __changeCase entry point. Reproduce the failure under the tr_TR locale, then determine how locale selection should work, including the proposed default value. Done means the case-conversion behavior is covered by tests and no longer fails for the reported locale.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.