Derby
  1. Derby
  2. DERBY-3852

J2EEDataSourceTest may ignore some failures

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: 10.5.3.1, 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Issue & fix info:
      Newcomer

      Description

      I noticed that the method testConnectionErrorEvent() in J2EEDataSourceTest had many occurrences of code that was structured like this:

      try

      { // do something with a connection }

      catch (SQLException e)

      { assertSQLState("...", e); }

      This code will only fail if an unexpected exception is thrown, not if the code in the try block fails to throw any exception at all.

      It may be that we can fix this by adding a call to fail() at the end of each try block. It may also be the case that the code is written like this because it is expected to throw exception with the embedded driver and succeed with the client driver (or the other way around). If the latter is the case, this should be made explicit, for instance by writing it like this:

      try

      { // do something with a connection assertFalse(usingEmbedded(), "should have failed with the embedded driver"); }

      catch (SQLException e) {
      if (!usingEmbedded())

      { throw e; }

      assertSQLState("...", e);
      }

      1. assert.diff
        0.7 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Hide
          Bryan Pendleton added a comment -

          It looks like this problem was fixed as part of the fix for DERBY-3853, by revision 764217. I think we can close this one.

          Show
          Bryan Pendleton added a comment - It looks like this problem was fixed as part of the fix for DERBY-3853 , by revision 764217. I think we can close this one.
          Hide
          Knut Anders Hatlen added a comment -

          It looks like most of it was fixed as part of DERBY-3853, but I found one occurrence that wasn't fixed yet. The attached patch fixes that one too.

          Committed revision 905224.

          Show
          Knut Anders Hatlen added a comment - It looks like most of it was fixed as part of DERBY-3853 , but I found one occurrence that wasn't fixed yet. The attached patch fixes that one too. Committed revision 905224.
          Hide
          Lily Wei added a comment -

          Reopen to 10.5 back port

          Show
          Lily Wei added a comment - Reopen to 10.5 back port
          Hide
          Kathey Marsden added a comment -

          re-closing after change to 10.5

          Sending .
          Sending java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\
          J2EEDataSourceTest.java
          Transmitting file data .
          Committed revision 961521.

          Show
          Kathey Marsden added a comment - re-closing after change to 10.5 Sending . Sending java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\ J2EEDataSourceTest.java Transmitting file data . Committed revision 961521.

            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