Skip to content

Commit fe467cd

Browse files
committed
test(spotbugs): suppress TextToSpeech findings + pre-existing bernardladenthin#266/bernardladenthin#267 findings
SpotBugs (effort=Max) flagged 5 Low/High findings; all are established false-positive categories already suppressed elsewhere with the same rationale: This PR (TextToSpeech, a native-handle wrapper like LlamaModel): - IMC_IMMATURE_CLASS_NO_TOSTRING — only field is the opaque native handle; a toString would emit just a pointer (mirrors the LlamaModelBackend suppression). - WEM_WEAK_EXCEPTION_MESSAGING on synthesize() — fixed "TextToSpeech is closed" precondition guard (mirrors the server request-parser guards). Pre-existing on main from the merged bernardladenthin#266/bernardladenthin#267 (this branch inherits them via the rebase; main is also red on them): - OpenAiRequestMapper.toCompletionParameters WEM — same input-validation guard as the already-suppressed toInferenceParameters; extended the existing Or-block. - ContentPart.inputAudio IMPROPER_UNICODE + LSC_LITERAL_STRING_COMPARISON — the canonical toLowerCase(Locale.ROOT)+equals format validation over a fixed ASCII pair; same false-positive class as the server.* IMPROPER_UNICODE block. Verified locally: mvn spotbugs:check -> BUILD SUCCESS (0 bugs).
1 parent f6d1e91 commit fe467cd

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

spotbugs-exclude.xml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,25 @@ SPDX-License-Identifier: MIT
437437
<Bug pattern="IMPROPER_UNICODE"/>
438438
</Match>
439439

440+
<!--
441+
ContentPart.inputAudio validates the audio-format token the canonical way: lowercase with the
442+
locale-safe Locale.ROOT, then compare against the two allowed ASCII literals ("wav" / "mp3"),
443+
throwing IllegalArgumentException otherwise. findsecbugs fires IMPROPER_UNICODE on the
444+
case-transform and LSC_LITERAL_STRING_COMPARISON on the literal .equals, but the operand domain
445+
is a fixed pair of ASCII format names — no Unicode case-folding collision exists, and comparing
446+
the normalised token against the literals is exactly the intended validation. Same false-positive
447+
category as the server.* IMPROPER_UNICODE block above. (Pre-existing finding from the merged
448+
audio-input feature; suppressed here so the branch's analysis is clean.)
449+
-->
450+
<Match>
451+
<Class name="net.ladenthin.llama.value.ContentPart"/>
452+
<Method name="inputAudio"/>
453+
<Or>
454+
<Bug pattern="IMPROPER_UNICODE"/>
455+
<Bug pattern="LSC_LITERAL_STRING_COMPARISON"/>
456+
</Or>
457+
</Match>
458+
440459
<!--
441460
LlamaModelBackend.stream bridges the model's Consumer-based streaming API (which cannot throw a
442461
checked exception) back to the IOException-throwing ChunkSink. A sink IOException is relayed out
@@ -471,7 +490,10 @@ SPDX-License-Identifier: MIT
471490
<Match>
472491
<Class name="net.ladenthin.llama.server.OpenAiRequestMapper"/>
473492
<Bug pattern="WEM_WEAK_EXCEPTION_MESSAGING"/>
474-
<Method name="toInferenceParameters"/>
493+
<Or>
494+
<Method name="toInferenceParameters"/>
495+
<Method name="toCompletionParameters"/>
496+
</Or>
475497
</Match>
476498

477499
<!--
@@ -549,4 +571,23 @@ SPDX-License-Identifier: MIT
549571
<Bug pattern="IMC_IMMATURE_CLASS_NO_TOSTRING"/>
550572
</Match>
551573

574+
<!--
575+
TextToSpeech is a native-handle wrapper like LlamaModel: its only instance field is the opaque
576+
`long handle` to the native OuteTTS engine. A generated toString would emit just that pointer
577+
value (no meaningful state), exactly the IMC_IMMATURE_CLASS_NO_TOSTRING / java/default-tostring
578+
case suppressed for LlamaModelBackend above, so toString is intentionally omitted. And
579+
synthesize() guards the closed handle with a fixed, descriptive precondition message
580+
("TextToSpeech is closed") — the value is closed-or-not by definition at that throw, with no
581+
extra state worth adding (same rationale as the server request-parser WEM suppressions above).
582+
-->
583+
<Match>
584+
<Class name="net.ladenthin.llama.TextToSpeech"/>
585+
<Bug pattern="IMC_IMMATURE_CLASS_NO_TOSTRING"/>
586+
</Match>
587+
<Match>
588+
<Class name="net.ladenthin.llama.TextToSpeech"/>
589+
<Bug pattern="WEM_WEAK_EXCEPTION_MESSAGING"/>
590+
<Method name="synthesize"/>
591+
</Match>
592+
552593
</FindBugsFilter>

0 commit comments

Comments
 (0)