Commit a26aa80
authored
fix: wrong existence check in getStaticResource (#24283)
On Jetty 12.1.9, requests for static resources packaged inside a JAR
(e.g. `vaadinPush.js` from `flow-push`) fail with
`FileSystemNotFoundException`. `VaadinServletService.getStaticResource`
verifies the URL returned by `ServletContext.getResource` via
`Path.of(url.toURI())`, which for a `jar:file:...!/entry` URI requires
the JAR's NIO `FileSystem` to already be mounted in the JVM-wide cache.
Jetty 12.1.8 incidentally kept those filesystems mounted during resource
resolution; 12.1.9 no longer does, so `getFileSystem` throws and the
existing `catch (URISyntaxException)` lets the unchecked exception
escape, producing HTTP 500.
Probe the URL with `URL.openStream()` instead. `JarURLConnection` and
`FileURLConnection` use `java.util.jar.JarFile` / `java.io.File`
directly and are independent of the NIO `FileSystems` cache, so the
check works uniformly for `file:` and `jar:file:` URLs and on every
Jetty 12 build. The catch is broadened to `IOException`, covering both
missing files (the original Jetty 12 workaround) and missing JAR
entries.1 parent 00b04b9 commit a26aa80
2 files changed
Lines changed: 56 additions & 10 deletions
File tree
- flow-server/src
- main/java/com/vaadin/flow/server
- test/java/com/vaadin/flow/server
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
338 | 336 | | |
339 | 337 | | |
340 | 338 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
331 | 339 | | |
332 | 340 | | |
333 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
334 | 380 | | |
335 | 381 | | |
336 | 382 | | |
| |||
0 commit comments