You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "John Gentilin (JIRA)" <xa...@xml.apache.org> on 2005/07/12 00:56:12 UTC

[jira] Commented: (XALANJ-2113) Exceptions created but not thrown

    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12315519 ] 

John Gentilin commented on XALANJ-2113:
---------------------------------------

Is seems that the author's intent was to throw the second configuration error exception instead of the first one. Compare the code in newXMLFilter (below) to another method processFromNode (below)

IMHO, I think they are both incorrect. If there is an exception on the errorListener, it should be ignored. If the error handler succeeds or fails, throw the originating error.

We also have another flavor of this in the method newTransformerHandler (below) where the exception variable ex is reassigned.

There is also some confusion why if the errorListener succeeds, we return null but if the error listener is non null or it fails we throw the exception. 

Shouldn't we always throw the exception. ???


newXMLFilter
    try {
      return new TrAXFilter(templates);
    } catch( TransformerConfigurationException ex ) {
      if( m_errorListener != null) {
        try {
          m_errorListener.fatalError( ex );
          return null;
        } catch( TransformerException ex1 ) {
          new TransformerConfigurationException(ex1);
        }
      }
      throw ex;
    }


processFromNode
    catch (org.xml.sax.SAXException se)
    {
      if (m_errorListener != null)
      {
        try
        {
          m_errorListener.fatalError(new TransformerException(se));
        }
        catch (TransformerException ex)
        {
          throw new TransformerConfigurationException(ex);
        }

        return null;
      }


newTransformerHandler
    } catch( TransformerConfigurationException ex ) {
      if( m_errorListener != null ) {
        try {
          m_errorListener.fatalError( ex );
          return null;
        } catch (TransformerException ex1 ) {
          ex=new TransformerConfigurationException(ex1);
        }
      }
      throw ex;
    }
    



> Exceptions created but not thrown
> ---------------------------------
>
>          Key: XALANJ-2113
>          URL: http://issues.apache.org/jira/browse/XALANJ-2113
>      Project: XalanJ2
>         Type: Bug
>   Components: transformation
>     Versions: CurrentCVS
>  Environment: win32 xp
>     Reporter: Dave Brosius
>     Assignee: John Gentilin
>     Priority: Minor

>
> Three instances of TranformFactoryImpl's implement the method newXMLFilter.
> In each case these methods create an Exception but do not throw it. It would seem that that was the intent of creating the exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org