Derby
  1. Derby
  2. DERBY-2516

Network Client allows execution of callable statement when one of the parameters is not set

    Details

    • Urgency:
      Low
    • Issue & fix info:
      Newcomer
    • Bug behavior facts:
      Embedded/Client difference

      Description

      If the second input parameter is set and the first is not. Client allows execution of the stored procedure. See the following code in LangProcedureTest.java with a reference to this bug.

      op.clearParameters();
      op.setString(2, "2");
      try

      { // a not set op.execute(); fail("FAIL - a not set"); }

      catch (SQLException sqle)

      { assertSQLState("07000", sqle); }
      1. d2516-1a.diff
        5 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          2096d 17h 57m 1 Knut Anders Hatlen 28/Dec/12 17:44
          In Progress In Progress Resolved Resolved
          5d 16h 21m 1 Knut Anders Hatlen 03/Jan/13 10:05
          Resolved Resolved Closed Closed
          607d 22h 25m 1 Knut Anders Hatlen 03/Sep/14 09:31
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update] Close all resolved issues that haven't been updated for more than one year.

          Show
          Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
          Kathey Marsden made changes -
          Labels derby_triage10_8 derby_backport_reject_10_8 derby_triage10_8
          Gavin made changes -
          Workflow jira [ 12401054 ] Default workflow, editable Closed status [ 12802103 ]
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info Newcomer,Patch Available [ 10423, 10102 ] Newcomer [ 10423 ]
          Fix Version/s 10.10.0.0 [ 12321550 ]
          Resolution Fixed [ 1 ]
          Hide
          Knut Anders Hatlen added a comment -

          Thanks, Dag!

          Committed revision 1428256.

          Show
          Knut Anders Hatlen added a comment - Thanks, Dag! Committed revision 1428256.
          Hide
          Dag H. Wanvik added a comment -

          The patch is straight-forward; looks good to me. +1
          Made a comment on DERBY-5945 to enable LangProcedureTest when that issue is fixed.

          Show
          Dag H. Wanvik added a comment - The patch is straight-forward; looks good to me. +1 Made a comment on DERBY-5945 to enable LangProcedureTest when that issue is fixed.
          Dag H. Wanvik made changes -
          Link This issue relates to DERBY-5945 [ DERBY-5945 ]
          Knut Anders Hatlen made changes -
          Issue & fix info Newcomer [ 10423 ] Newcomer,Patch Available [ 10423, 10102 ]
          Knut Anders Hatlen made changes -
          Attachment d2516-1a.diff [ 12562899 ]
          Hide
          Knut Anders Hatlen added a comment -

          Attaching a patch that makes checkThatAllParametersAreSet() throw an exception if an INOUT parameter has not been set and adds a test case to ProcedureTest to verify that it works.

          The patch also enables the failing code in LangProcedureTest for the client driver. Note that LangProcedureTest does not run as part of suites.All yet, as it needs more fixes to run cleanly (Dag has a patch for that in DERBY-5945, but it's not yet committed).

          All the regression tests ran cleanly with the patch.

          Show
          Knut Anders Hatlen added a comment - Attaching a patch that makes checkThatAllParametersAreSet() throw an exception if an INOUT parameter has not been set and adds a test case to ProcedureTest to verify that it works. The patch also enables the failing code in LangProcedureTest for the client driver. Note that LangProcedureTest does not run as part of suites.All yet, as it needs more fixes to run cleanly (Dag has a patch for that in DERBY-5945 , but it's not yet committed). All the regression tests ran cleanly with the patch.
          Knut Anders Hatlen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Knut Anders Hatlen made changes -
          Assignee Knut Anders Hatlen [ knutanders ]
          Hide
          Knut Anders Hatlen added a comment -

          The problem appears to be caused by client.am.PreparedStatement.checkThatAllParametersAreSet(), which checks that every parameter is either set or registered as an out parameter. In the failing test case, parameter 1 is registered as an output parameter, so checkThatAllParametersAreSet() thinks everything is OK. However, since it's an INOUT parameter it needs to be set even if it has been registered as an out parameter.

          We should make checkThatAllParametersAreSet() always raise an exception if an INOUT parameter isn't set.

          Show
          Knut Anders Hatlen added a comment - The problem appears to be caused by client.am.PreparedStatement.checkThatAllParametersAreSet(), which checks that every parameter is either set or registered as an out parameter. In the failing test case, parameter 1 is registered as an output parameter, so checkThatAllParametersAreSet() thinks everything is OK. However, since it's an INOUT parameter it needs to be set even if it has been registered as an out parameter. We should make checkThatAllParametersAreSet() always raise an exception if an INOUT parameter isn't set.
          Kathey Marsden made changes -
          Labels derby_triage10_8
          Bug behavior facts [Embedded/Client difference]
          Urgency Low
          Issue & fix info [Newcomer]
          Hide
          Kathey Marsden added a comment -

          Triaged for 10.8. Marked newcomer hoping the fix is as clear as the reproduction.

          Show
          Kathey Marsden added a comment - Triaged for 10.8. Marked newcomer hoping the fix is as clear as the reproduction.
          Mike Matrigali made changes -
          Component/s Network Client [ 11690 ]
          Hide
          Kathey Marsden added a comment -

          found while converting procedure.java

          Show
          Kathey Marsden added a comment - found while converting procedure.java
          Kathey Marsden made changes -
          Field Original Value New Value
          Link This issue is related to DERBY-2461 [ DERBY-2461 ]
          Kathey Marsden created issue -

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development