Derby
  1. Derby
  2. DERBY-4311

BaseJDBCTestCase.assertErrorCode() never fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Urgency:
      Low

      Description

      BaseJDBCTestCase.assertErrorCode() doesn't throw an exception if the error code does not match the expected code.

      public static void assertErrorCode(String message, int expected, SQLException exception) {
      while (exception != null)
      {
      try

      { assertEquals(message, expected,exception.getErrorCode()); }

      catch (AssertionFailedError e)

      { // check and see if our error code is in a chained exception exception = exception.getNextException(); }

      }
      }

      If the error code doesn't match, assertEquals() will raise an error, but the exception is caught and silently ignored.

      Since none of the tests uses assertErrorCode() I suggest we remove it. We can re-implement one that works later if the need arises.

      1. assertErrorCode.diff
        1 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        The attached patch removes the two unused assertErrorCode() methods. I'm running suites.All as a sanity test and will commit if it passes.

        Show
        Knut Anders Hatlen added a comment - The attached patch removes the two unused assertErrorCode() methods. I'm running suites.All as a sanity test and will commit if it passes.
        Hide
        Kristian Waagan added a comment -

        +1

        Show
        Kristian Waagan added a comment - +1
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 795092.

        Show
        Knut Anders Hatlen added a comment - Committed revision 795092.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development