1. Derby
  2. DERBY-5803

Make error handling in xaHelper more explicit


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s:
    • Fix Version/s:
    • Component/s: Tools
    • Labels:


      In xaHelper the method handleException returns nothing (void), but it always throws an exception. Typically used inside a catch-block, this pattern confuses (static) code analyzers and reduces code readability.

      In this case it is possible to make the method return SQLException and write "throw handleException(t)", which makes it clear that the flow will stop if it reaches the catch block. Note that the method may still throw a RuntimeException, which I will document in the method Javadoc.

      The latter pattern is other places in the Derby code base, but I haven't checked for consistency. One specific case worth mentioning is the one in DRDAConnThread. This one is different in that it only takes correct actions, but doesn't actually throw an exception since we wan't the server thread to keep processing/executing after having cleaned up and informed the client.


        Kristian Waagan created issue -
        Kristian Waagan made changes -
        Field Original Value New Value
        Attachment derby-5803-1a-explict_throw.diff [ 12531392 ]
        Kristian Waagan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Kristian Waagan [ kristwaa ]
        Fix Version/s [ 12321550 ]
        Resolution Fixed [ 1 ]
        Kristian Waagan made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Gavin made changes -
        Workflow jira [ 12672560 ] Default workflow, editable Closed status [ 12801808 ]


          • Assignee:
            Kristian Waagan
            Kristian Waagan
          • Votes:
            0 Vote for this issue
            4 Start watching this issue


            • Created: