Launch with argument like -DlegacyClassPath=/path/to.jar would throw NPE and fail because artifactMaybe would be / so that artifactMaybe.getFileName() return null.
java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.toString()" because the return value of "java.nio.file.Path.getFileName()" is null
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.JarMetadata.fromFileName(JarMetadata.java:60)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.JarMetadata.from(JarMetadata.java:44)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.SecureJar.lambda$from$1(SecureJar.java:42)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.SecureJar$$Lambda$97/0x00000000f4842b00.apply(Unknown Source)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.impl.Jar.<init>(Jar.java:133)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.SecureJar.from(SecureJar.java:58)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.SecureJar.from(SecureJar.java:50)
at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.SecureJar.from(SecureJar.java:42)
at cpw.mods.bootstraplauncher@0.1.17/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:60)
|
static SimpleJarMetadata fromFileName(final Path path, final Set<String> pkgs, final List<SecureJar.Provider> providers) { |
|
|
|
// detect Maven-like paths |
|
Path versionMaybe = path.getParent(); |
|
if (versionMaybe != null) |
|
{ |
|
Path artifactMaybe = versionMaybe.getParent(); |
|
if (artifactMaybe != null && path.getFileName().toString().startsWith(artifactMaybe.getFileName().toString() + "-" + versionMaybe.getFileName().toString())) |
|
{ |
|
var name = artifactMaybe.getFileName().toString(); |
Launch with argument like
-DlegacyClassPath=/path/to.jarwould throw NPE and fail becauseartifactMaybewould be/so thatartifactMaybe.getFileName()return null.securejarhandler/src/main/java/cpw/mods/jarhandling/JarMetadata.java
Lines 53 to 62 in 026bc1f