Commit e20b62e
Add lenient XML validation for editor mode (Issue #261)
Implement two-stage parsing strategy that distinguishes between unparseable XML
(malformed syntax) and parseable XML with validation errors:
- Add XMLContextFactory.createContextLenient() with lenient parsing mode
- Stage 1: Try full validation (schema + structural)
- Stage 2: On validation failure, retry without schema validation
- Return LenientParseResult with parseability status and validation errors
- Enhance ValidationDialog with conditional "Open Anyway" button
- Dynamic title: "Warning" for parseable errors, "Error" for unparseable
- allowOpenAnyway parameter controls button visibility
- Always focus Cancel button for conservative UX
- Update MenuBar file opening logic with three-tier handling:
1. Valid XML → open directly
2. Parseable with errors → show ValidationDialog with "Open Anyway"
3. Unparseable → block with error message
- Add comprehensive test coverage:
- XMLContextFactoryLenientTest: 5 edge case tests (empty files, large files,
special characters, exception handling, sequential parsing)
- ValidationDialogTest: 5 interaction tests (button visibility, title
adaptation, dual-button configuration)
Enables users to open and fix XML files with validation errors while still
blocking malformed/unparseable XML. Improves editor usability for error
correction workflows.
Test count: 1855 → 1860 (+5 net)
Coverage: 38.5% on new code (SonarQube target: ≥80%)1 parent 10da28f commit e20b62e
5 files changed
Lines changed: 589 additions & 36 deletions
File tree
- src
- main/kotlin/cz/vutbr/fit/interlockSim
- gui
- xml
- test/kotlin/cz/vutbr/fit/interlockSim
- gui
- xml
Lines changed: 55 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
63 | 72 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
67 | 105 | | |
68 | | - | |
69 | | - | |
| 106 | + | |
70 | 107 | | |
71 | 108 | | |
72 | 109 | | |
73 | | - | |
| 110 | + | |
74 | 111 | | |
75 | 112 | | |
76 | 113 | | |
| |||
Lines changed: 40 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
182 | 203 | | |
183 | 204 | | |
184 | | - | |
| 205 | + | |
| 206 | + | |
185 | 207 | | |
186 | 208 | | |
187 | 209 | | |
| |||
202 | 224 | | |
203 | 225 | | |
204 | 226 | | |
205 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
206 | 234 | | |
207 | 235 | | |
208 | 236 | | |
| |||
212 | 240 | | |
213 | 241 | | |
214 | 242 | | |
| 243 | + | |
215 | 244 | | |
216 | 245 | | |
217 | 246 | | |
218 | 247 | | |
219 | 248 | | |
220 | | - | |
| 249 | + | |
| 250 | + | |
221 | 251 | | |
222 | | - | |
| 252 | + | |
223 | 253 | | |
224 | 254 | | |
225 | 255 | | |
| |||
0 commit comments