提交 6351a8a2 编写于 作者: F Felix Belzunce Arcos

JENKINS-26203

上级 2f59ffc4
...@@ -56,6 +56,8 @@ import java.io.FileInputStream; ...@@ -56,6 +56,8 @@ import java.io.FileInputStream;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -147,8 +149,8 @@ public class ClassicPluginStrategy implements PluginStrategy { ...@@ -147,8 +149,8 @@ public class ClassicPluginStrategy implements PluginStrategy {
@Override public PluginWrapper createPluginWrapper(File archive) throws IOException { @Override public PluginWrapper createPluginWrapper(File archive) throws IOException {
final Manifest manifest; final Manifest manifest;
URL baseResourceURL;
URL baseResourceURL = null;
File expandDir = null; File expandDir = null;
// if .hpi, this is the directory where war is expanded // if .hpi, this is the directory where war is expanded
...@@ -197,7 +199,21 @@ public class ClassicPluginStrategy implements PluginStrategy { ...@@ -197,7 +199,21 @@ public class ClassicPluginStrategy implements PluginStrategy {
if (libs != null) if (libs != null)
paths.addAll(Arrays.asList(libs)); paths.addAll(Arrays.asList(libs));
baseResourceURL = expandDir.toURI().toURL(); try {
Class pathJDK7 = Class.forName("java.nio.file.Path");
Object toPath = File.class.getMethod("toPath").invoke(expandDir);
URI uri = (URI) pathJDK7.getMethod("toUri").invoke(toPath);
baseResourceURL = uri.toURL();
} catch (NoSuchMethodException e) {
throw new Error(e);
} catch (ClassNotFoundException e) {
baseResourceURL = expandDir.toURI().toURL();
} catch (InvocationTargetException e) {
throw new Error(e);
} catch (IllegalAccessException e) {
throw new Error(e);
}
} }
File disableFile = new File(archive.getPath() + ".disabled"); File disableFile = new File(archive.getPath() + ".disabled");
if (disableFile.exists()) { if (disableFile.exists()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册