When loading JS includes with a full classpath reference, handle the Eclipse classloader behaving slightly differently on absolute paths compared to the JVM one

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28716 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-06-30 10:31:12 +00:00
parent 1d8438e7bf
commit 24a746c5d8

View File

@@ -320,9 +320,14 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
{
try
{
// load from classpath
// Load from classpath
String scriptClasspath = resource.substring(PATH_CLASSPATH.length());
URL scriptResource = getClass().getClassLoader().getResource(scriptClasspath);
if (scriptResource == null && scriptClasspath.startsWith("/"))
{
// The Eclipse classloader prefers alfresco/foo to /alfresco/foo, try that
scriptResource = getClass().getClassLoader().getResource(scriptClasspath.substring(1));
}
if (scriptResource == null)
{
throw new AlfrescoRuntimeException("Unable to locate included script classpath resource: " + resource);