Commit ff28191
committed
Pin charsets to UTF-8 in two test sites uncovered by charset audit
Audit of byte/char boundaries across all production and test source
revealed two test-only sites with implicit charset dependencies:
- ContentPartTest.imageFileRejectsUnknownExtension: replace
Files.write(file, "hello".getBytes()) with Files.writeString(file,
"hello"). The string is ASCII so byte output was identical
everywhere today, but Files.writeString uses UTF-8 by contract
(per JDK docs since Java 11) and the new form is shorter.
- LlamaModelTest.completeAndReadStdOut: pin the PrintStream that
captures System.out and the matching ByteArrayOutputStream.toString
to StandardCharsets.UTF_8. Model output is multi-byte UTF-8 token
text; on a non-UTF-8 default host (e.g. Windows CP-1252) the
captured assertion strings would mangle non-ASCII tokens. Removes
the stale @SuppressWarnings('ImplicitDefaultCharsetUsage').
Spotbugs count unchanged at 0. Tests pass cleanly through the
charset-pinned capture path.1 parent 4ace716 commit ff28191
2 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
611 | | - | |
612 | | - | |
| 612 | + | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
| 625 | + | |
626 | 626 | | |
627 | 627 | | |
628 | 628 | | |
| |||
0 commit comments