* @throws IOException if stream can't be parsed or object can't be created
* cause to illegal content of stream
*/
public Object instantiateScript(InputStream stream, String name) throws IOException
{
GroovyClassLoader loader;
if (mapping.size() > 0)
{
JarJarClassLoader jarjarLoader = SecurityHelper.doPrivilegedAction(new PrivilegedAction<JarJarClassLoader>()
{
public JarJarClassLoader run()
{
return new JarJarClassLoader();
}
});
jarjarLoader.addMapping(mapping);
loader = jarjarLoader;
}
else
{
loader = SecurityHelper.doPrivilegedAction(new PrivilegedAction<GroovyClassLoader>()
{
public GroovyClassLoader run()
{
return new GroovyClassLoader();
}
});
}
return instantiateScript(stream, name, loader);
}