} catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) {
} catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { }
  public void transform(Source source)     throws TransformerException  {    if(source instanceof DOMSource)    {      DOMSource dsource = (DOMSource)source;      m_urlOfSource = dsource.getSystemId();      Node dNode = dsource.getNode();      if (null != dNode)      {          this.transformNode(dsource.getNode());        return;      }      else      {        String messageStr = XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null);        throw new IllegalArgumentException(messageStr);      }     }    InputSource xmlSource = SAXSource.sourceToInputSource(source);    if(null == xmlSource)    {      throw new TransformerException("Can't transform a Source of type "+        source.getClass().getName()+"!");    }        if (null != xmlSource.getSystemId())      m_urlOfSource = xmlSource.getSystemId();    try    {      XMLReader reader = null;      if(source instanceof SAXSource)        reader = ((SAXSource)source).getXMLReader();      // Use JAXP1.1 ( if possible )      try {          javax.xml.parsers.SAXParserFactory factory=              javax.xml.parsers.SAXParserFactory.newInstance();          factory.setNamespaceAware( true );          javax.xml.parsers.SAXParser jaxpParser=              factory.newSAXParser();          reader=jaxpParser.getXMLReader();                } catch( javax.xml.parsers.ParserConfigurationException ex ) {          throw new org.xml.sax.SAXException( ex );      } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {          throw new org.xml.sax.SAXException( ex1.toString() );      } catch( NoSuchMethodError ex2 ) {      }      if (null == reader)      {        reader = XMLReaderFactory.createXMLReader();      }      try      {        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",                          true);        reader.setFeature("http://apache.org/xml/features/validation/dynamic",                          true);      }      catch (org.xml.sax.SAXException se)      {        // We don't care.      }      // Get the input content handler, which will handle the       // parse events and create the source tree.       ContentHandler inputHandler = getInputContentHandler();      reader.setContentHandler(inputHandler);      if(inputHandler instanceof org.xml.sax.DTDHandler)        reader.setDTDHandler((org.xml.sax.DTDHandler)inputHandler);      try      {        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)          reader.setProperty("http://xml.org/sax/properties/lexical-handler",                             inputHandler);        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)          reader.setProperty("http://xml.org/sax/properties/declaration-handler",                             inputHandler);      }      catch(org.xml.sax.SAXException se) {}      try      {        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)          reader.setProperty("http://xml.org/sax/handlers/LexicalHandler",                             inputHandler);        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)          reader.setProperty("http://xml.org/sax/handlers/DeclHandler",                             inputHandler);      }      catch(org.xml.sax.SAXNotRecognizedException snre)      {      }      // Set the reader for cloning purposes.      getXPathContext().setPrimaryReader(reader);      this.m_exceptionThrown = null;      if (inputHandler instanceof SourceTreeHandler)      {        SourceTreeHandler sth = (SourceTreeHandler) inputHandler;        sth.setInputSource(source);        sth.setUseMultiThreading(true);        Node doc = sth.getRoot();        if (null != doc)        {          SourceTreeManager stm = getXPathContext().getSourceTreeManager();          stm.putDocumentInCache(doc, source);          m_xmlSource = source;          m_doc = doc;          if (isParserEventsOnMain())          {            m_isTransformDone = false;            getXPathContext().getPrimaryReader().parse(xmlSource);          }          else          {            Thread t = new Thread(this);            t.start();            transformNode(doc);          }        }      }      else      {        // ??        reader.parse(xmlSource);      }      // Kick off the parse.  When the ContentHandler gets       // the startDocument event, it will call transformNode( node ).      // reader.parse( xmlSource );      // This has to be done to catch exceptions thrown from       // the transform thread spawned by the STree handler.      Exception e = getExceptionThrown();      if (null != e)      {        if (e instanceof javax.xml.transform.TransformerException)          throw (javax.xml.transform.TransformerException) e;        else if (e instanceof org.apache.xml.utils.WrappedRuntimeException)          throw new javax.xml.transform.TransformerException(            ((org.apache.xml.utils.WrappedRuntimeException) e).getException());        else        {          throw new javax.xml.transform.TransformerException(e);        }      }      else if (null != m_resultTreeHandler)      {        m_resultTreeHandler.endDocument();      }    }    catch (org.apache.xml.utils.WrappedRuntimeException wre)    {      Throwable throwable = wre.getException();      while (throwable             instanceof org.apache.xml.utils.WrappedRuntimeException)      {        throwable =          ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException();      }      throw new TransformerException(wre.getException());    }    catch(org.xml.sax.SAXException se)    {      throw new TransformerException(se);    }    catch (IOException ioe)    {      throw new TransformerException(ioe);    }    finally    {      reset();    }  }