You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Dave Brosius (JIRA)" <xa...@xml.apache.org> on 2005/05/03 17:34:25 UTC

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

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
    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


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

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2113?page=all ]

Henry Zongaro updated XALANJ-2113:
----------------------------------

       reviewer: zongaro@ca.ibm.com
    Description: 
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.

  was:
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.


> 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
>  Attachments: XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "John Gentilin (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2113?page=all ]

John Gentilin updated XALANJ-2113:
----------------------------------

    Attachment: XfmrFacImpl-JIRA2113-Patch.txt

Clean up exception handling code

> 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
>  Attachments: XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "John Gentilin (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2113?page=all ]

John Gentilin updated XALANJ-2113:
----------------------------------

    Attachment: TransFacImpl-patch.txt

Revised patch

> 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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12316033 ] 

Henry Zongaro commented on XALANJ-2113:
---------------------------------------

I have reviewed John's patch,[1] and I believe that it correctly resolves the problem in org.apache.xalan.processor.TransformerFactoryImpl - as well as improving how exceptions thrown by the ErrorListener are handled.  However, the initial report pointed out that this same problem also exists in org.apache.xalan.xsltc.trax.TransformerFactoryImpl and org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl.

John, if you apply the patch, please keep the bug report open so that we can keep track of the problem in the other TransformerFactory implementations.

[1] http://issues.apache.org/jira/secure/attachment/12311237/TransFacImpl-patch.txt

> 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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12317989 ] 

Henry Zongaro commented on XALANJ-2113:
---------------------------------------

Sorry, "the same problem that you'll find in" should read, "the same problem that used to exist in...."

> 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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "John Gentilin (JIRA)" <xa...@xml.apache.org>.
    [ 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


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

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12317988 ] 

Henry Zongaro commented on XALANJ-2113:
---------------------------------------

John, lines 962-964 of org.apache.xalan.xsltc.trax.TransformerFactoryImpl and lines 443-445 of org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl read as follows:

                catch (TransformerException e2) {
                    new TransformerConfigurationException(e2);
                }

The TransformerConfigurationException that's constructed in this catch block is never thrown; instead, the original exception, e1, will be thrown.  That's what Dave Brosius originally complained about.

This segment of code also has the same problem that you'll find in org.apache.xalan.processor.TransformerFactoryImpl:  if the ErrorListener throws a TransformerConfigurationException - a subclass of TransformerException - this catch block will wrap it inside a second TransformerConfigurationException.  There should be two catch blocks, one that handles TransformerConfigurationException and one that handles TransformerException.

> 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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "John Gentilin (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12316623 ] 

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

Henry.

I have applied the patch to CVS. I also went back and reviewed the other classes and I could not find problems with the exception handling.
I will live the JIRA issue open to be used as a discussion point.

> 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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2113?page=comments#action_12315859 ] 

Brian Minchau commented on XALANJ-2113:
---------------------------------------

If an error is detected, perhaps an exception is thrown and caught, the
ErrorListener should be made aware or the error and the exception is
consumed, leaving it to the ErrorListener to decide what to do.
If the error listener only writes to a log file, then that is the
ErrorListener's choice, or it could throw the exception.

If the ErrorListener throws an exception, then that is the exception
that should percolate up.


However this code,
newTransformerHandler 

    } catch( TransformerConfigurationException ex ) { 
      if( m_errorListener != null ) { 
        try { 
          m_errorListener.fatalError( ex ); 
          return null; 
        } catch(TransformerConfigurationException tce) {
           ex = tce;  // just percolate up
        } catch (TransformerException ex1 ) { 
           // wrap 
          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
>  Attachments: TransFacImpl-patch.txt, XfmrFacImpl-JIRA2113-Patch.txt
>
> 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


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

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2113?page=all ]

Brian Minchau reassigned XALANJ-2113:
-------------------------------------

    Assign To: John Gentilin

Assign to John G. to have a look at this one, per the JIRA meeting June 7, 2005.

> 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