Commit 9704a20
Fix UnknownFormatConversionException (#13162)
* Fix UnknownFormatConversionException when user input contains percent signs
StaticResolvableString.resolve() called String.format(value, ...) unconditionally,
treating the value as a format string. When the value is raw user input (e.g. from
a text field whose contentDescription is built via String.resolvableString), any
percent sign sequence such as "%@" causes a java.util.UnknownFormatConversionException.
Fix: skip String.format when the args list is empty. All String.resolvableString
usages pass emptyList() for args, so no formatting is ever needed — the value
should be returned as-is.
Adds regression tests in ResolvableStringTest covering format specifiers in
no-arg static strings, and a test in CvcControllerTest confirming that
contentDescription resolves without throwing when the CVC field contains "%@".
Committed-By-Agent: goose
* Address PR review feedback
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
---------
Co-authored-by: codex <noreply@openai.com>1 parent 662c99b commit 9704a20
2 files changed
Lines changed: 26 additions & 1 deletion
File tree
- stripe-core/src
- main/java/com/stripe/android/core/strings
- test/java/com/stripe/android/core/strings
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
105 | 125 | | |
106 | 126 | | |
107 | 127 | | |
| |||
0 commit comments