mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-07 09:06:03 +00:00
[JENKINS-43531] Plugins may not be expecting InvalidPathException
- Plugins should really be expecting it, but as historically they have not, may as well convert to IOE for them
This commit is contained in:
1 parent
33942677d4
commit
3871d7778e
31 files changed
+209
-46
No files matched your search
@@ -25,6 +25,7 @@ package hudson;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import jenkins.util.SystemProperties;
|
||||
import com.google.common.collect.Lists;
|
||||
import hudson.Plugin.DummyImpl;
|
||||
@@ -127,6 +128,8 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
String firstLine;
|
||||
try (InputStream manifestHeaderInput = Files.newInputStream(archive.toPath())) {
|
||||
firstLine = IOUtils.readFirstLine(manifestHeaderInput, "UTF-8");
|
||||
} catch (InvalidPathException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
if (firstLine.startsWith("Manifest-Version:")) {
|
||||
// this is the manifest already
|
||||
@@ -138,6 +141,8 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
// Read the manifest
|
||||
try (InputStream manifestInput = Files.newInputStream(archive.toPath())) {
|
||||
return new Manifest(manifestInput);
|
||||
} catch (InvalidPathException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IOException("Failed to load " + archive, e);
|
||||
@@ -171,6 +176,8 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
}
|
||||
try (InputStream fin = Files.newInputStream(manifestFile.toPath())) {
|
||||
manifest = new Manifest(fin);
|
||||
} catch (InvalidPathException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user