m_mgr = managerClass.newInstance(); m_engine = mgrLoadScriptingEngine.invoke(m_mgr, new Object[]{ scriptLang });
Method loadScriptingEngine = manager.getClass() .getMethod("loadScriptingEngine", new Class[]{ String.class });  m_engine = loadScriptingEngine.invoke(manager, new Object[]{ scriptLang });  Method engineExec = m_engine.getClass().getMethod("exec", new Class[]{ String.class, Integer.TYPE, Integer.TYPE, Object.class });
  public ExtensionHandlerGeneral(          String namespaceUri, StringVector elemNames, StringVector funcNames, String scriptLang, String scriptSrcURL, String scriptSrc, String systemId)            throws TransformerException  {    super(namespaceUri, scriptLang);    if (elemNames != null)    {      Object junk = new Object();      int n = elemNames.size();      for (int i = 0; i < n; i++)      {        String tok = elemNames.elementAt(i);        m_elements.put(tok, junk);  // just stick it in there basically      }    }    if (funcNames != null)    {      Object junk = new Object();      int n = funcNames.size();      for (int i = 0; i < n; i++)      {        String tok = funcNames.elementAt(i);        m_functions.put(tok, junk);  // just stick it in there basically      }    }    m_scriptSrcURL = scriptSrcURL;    m_scriptSrc = scriptSrc;    if (m_scriptSrcURL != null)    {      URL url = null;      try{        url = new URL(m_scriptSrcURL);      }      catch (java.net.MalformedURLException mue)      {        int indexOfColon = m_scriptSrcURL.indexOf(':');        int indexOfSlash = m_scriptSrcURL.indexOf('/');        if ((indexOfColon != -1) && (indexOfSlash != -1)            && (indexOfColon < indexOfSlash))        {          // The url is absolute.          url = null;          throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue); //"src attribute not yet supported for "          //+ scriptLang);        }        else        {          try{            url = new URL(new URL(SystemIDResolver.getAbsoluteURI(systemId)), m_scriptSrcURL);                    }                  catch (java.net.MalformedURLException mue2)          {            throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue2); //"src attribute not yet supported for "          //+ scriptLang);          }        }      }      if (url != null)      {        try        {          URLConnection uc = url.openConnection();          InputStream is = uc.getInputStream();          byte []bArray = new byte[uc.getContentLength()];          is.read(bArray);          m_scriptSrc = new String(bArray);                  }        catch (IOException ioe)        {          throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), ioe); //"src attribute not yet supported for "          //+ scriptLang);        }      }          }       if (null == managerClass)      throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_INIT_BSFMGR, null)); //"Could not initialize BSF manager");    try    {      m_mgr = managerClass.newInstance();      m_engine = mgrLoadScriptingEngine.invoke(m_mgr,                                               new Object[]{ scriptLang });      // "Compile" the program      engineExec.invoke(m_engine, new Object[]{ "XalanScript", NEG1INT,                                                NEG1INT, m_scriptSrc });    }    catch (Exception e)    {      e.printStackTrace();      throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_CMPL_EXTENSN, null), e); //"Could not compile extension", e);    }  }