Commit 8d3b608
authored
Handle the case of a Multi-Release Jar not actually containing Multi-Release Classes (#42)
Seen a couple of people encounter this in mod dev (when adding
dependencies):
SJH considers a Jar to be `Multi-Release` based on the `Manifest`
<https://github.com/McModLauncher/securejarhandler/blob/96a7b6a8fe1f1117e01dfd94c640757154372a68/src/main/java/cpw/mods/jarhandling/impl/Jar.java#L124>
If it is then it resolves a path to `/META-INF/versions`
<https://github.com/McModLauncher/securejarhandler/blob/96a7b6a8fe1f1117e01dfd94c640757154372a68/src/main/java/cpw/mods/jarhandling/impl/Jar.java#L126>
And tries to walk it
<https://github.com/McModLauncher/securejarhandler/blob/96a7b6a8fe1f1117e01dfd94c640757154372a68/src/main/java/cpw/mods/jarhandling/impl/Jar.java#L127>
This works for most Jars, however it does not consider the case where a
Jar is erroneously marked as `Multi-Release`, with `/META-INF/versions`
**not** existing.
If this is the case, `Files.walk` will throw a
`UnionFileSystem$NoSuchFileException` which is then wrapped and rethrown
as a `UncheckedIOException`
<https://github.com/McModLauncher/securejarhandler/blob/96a7b6a8fe1f1117e01dfd94c640757154372a68/src/main/java/cpw/mods/jarhandling/impl/Jar.java#L138>
Attached Example Stacktrace,
<https://gist.github.com/AterAnimAvis/35ded98d52a78c2f257d59173c86366c>
---
Current implementation of a fix is from a bit of spitballing [in
Discord](https://discord.com/channels/313125603924639766/922237746460893234/1129415771567689738)1 parent bbf1ff4 commit 8d3b608
File tree
3 files changed
+10
-0
lines changed- src
- main/java/cpw/mods/jarhandling/impl
- test
- java/cpw/mods/jarhandling/impl
- resources/multirelease-noversions/META-INF
3 files changed
+10
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments