TransactionStateDiff.applyDiff swallows original exception
----------------------------------------------------------

                 Key: GEOT-3814
                 URL: https://jira.codehaus.org/browse/GEOT-3814
             Project: GeoTools
          Issue Type: Bug
          Components: main
    Affects Versions: 2.7.2
            Reporter: Luke Douglas
            Assignee: Jody Garnett
            Priority: Minor
         Attachments: TransactionStateDiff.java.diff

If an exception is thrown while attempting to apply a diff, and subsequently 
another exception is thrown by code in the final finally... block, the original 
exception will be swallowed and only the final exception will be thrown. This 
makes debugging the underlying issue challenging. (For example, my application 
had a bug that caused the nextFeature.setAttributes call on line 251 to throw a 
ClassCastException; however, the exception that came back was from writer.close 
on line 266.) A quick Google search suggested at least one more case where a 
developer was similarly confused by this issue.

I've attached a diff that illustrates a potential fix: save the original 
exception; then, if the finally... block throws its own exception, catch it and 
set the cause before rethrowing.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to