From fb5127ed12e71e8a9deaedabd72ff47df2549dbe Mon Sep 17 00:00:00 2001 From: kohsuke Date: Wed, 16 Apr 2008 01:58:10 +0000 Subject: [PATCH] Fixed a problem related to OC4J. See http://www.nabble.com/Hudson-on-OC4J-tt16702113.html git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8632 71c3de6d-444a-0410-be80-ed276b4c234a --- remoting/src/main/java/hudson/remoting/Which.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/remoting/src/main/java/hudson/remoting/Which.java b/remoting/src/main/java/hudson/remoting/Which.java index c0509767d2..bc23d6d8b1 100644 --- a/remoting/src/main/java/hudson/remoting/Which.java +++ b/remoting/src/main/java/hudson/remoting/Which.java @@ -32,6 +32,12 @@ public class Which { return new File(decode(new URL(resURL).getPath())); } + if(resURL.startsWith("code-source:/")) { + // OC4J apparently uses this. See http://www.nabble.com/Hudson-on-OC4J-tt16702113.html + resURL = resURL.substring("code-source:/".length(), resURL.lastIndexOf('!')); // cut off jar: and the file name portion + return new File(decode(new URL(resURL).getPath())); + } + if(resURL.startsWith("file:")) { // unpackaged classes int n = clazz.getName().split("\\.").length; // how many slashes do wo need to cut?