Commit 311f8d6
committed
spotbugs(WEM) Batch 3: enrich Session IllegalStateException messages (5 cleared)
Adds in-scope state (slotId + transcript size) to the 5 state-machine
IllegalStateException messages thrown by Session.send / stream /
commitStreamedReply / save / restore.
Before:
throw new IllegalStateException(
"stream in progress; call commitStreamedReply(...) before send(...)");
After:
throw new IllegalStateException(
"stream in progress on slot " + slotId
+ " (transcript=" + turns.size() + " turns)"
+ "; call commitStreamedReply(...) before send(...)");
Why both fields:
- slotId identifies which session got stuck in a multi-session setup
(a process can hold many Sessions on the same model, one per slot).
- turns.size() shows how far the transcript progressed before the
state-machine violation — useful when triaging "the session went
weird around message N" reports.
Compatibility:
- Session is final (line 41) — no subclass override risk.
- No test asserts on the exception message text (verified across
SessionConcurrencyTest, LlamaModelTest).
THROWS_METHOD_THROWS_RUNTIMEEXCEPTION findings on Session.send and
Session.stream (the catch+cleanup+rethrow pattern at line 112 / 138)
are deliberately NOT addressed in this batch; they are deferred to
their own investigation alongside the existing BAF suppression
(spotbugs/spotbugs#3918 + PR #4087 lifecycle).
SpotBugs Max+Low: WEM goes 10 -> 5. Total jllama: 39 -> 34.1 parent 5fd7b4d commit 311f8d6
1 file changed
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| |||
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
| |||
165 | 174 | | |
166 | 175 | | |
167 | 176 | | |
168 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
169 | 181 | | |
170 | 182 | | |
171 | 183 | | |
| |||
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
184 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
185 | 199 | | |
186 | 200 | | |
187 | 201 | | |
| |||
0 commit comments