PicoContainer
  1. PicoContainer
  2. PICO-121

Don't throw ArrayIndexOutOfBoundsException if a matching constructor is not found

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-5
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In ConstructorComponentAdapter.getAllSatisfiableConstructors(List constructors, PicoContainer picoContainer), the index i is on currentParameters.

      If parameterTypes[] (derived from the list of current contructor parameters) has less elements than currentParameters, access to parameterTypes[i] will be out of bounds and throw ArrayIndexOutOfBoundsException.

      I think the lengths should be verified and an appropriate Exception be thrown before entering the 'for' loop.

        Issue Links

          Activity

          Hide
          Aslak Hellesøy added a comment -

          I believe this is fixed. If not, please provide a failing test case to illustrate the bug.

          Show
          Aslak Hellesøy added a comment - I believe this is fixed. If not, please provide a failing test case to illustrate the bug.
          Aslak Hellesøy made changes -
          Field Original Value New Value
          Assignee Aslak Hellesoy [ rinkrank ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Fix Version/s 1.0-beta-5 [ 10145 ]
          Hide
          Jörg Schaible added a comment -

          Well, sorry, no. The Exception is raised on the parameters field, not on the ctor list/array. Fix provided with PICO-131.

          Show
          Jörg Schaible added a comment - Well, sorry, no. The Exception is raised on the parameters field, not on the ctor list/array. Fix provided with PICO-131 .
          Aslak Hellesøy made changes -
          Link This issue is duplicated by PICO-131 [ PICO-131 ]

            People

            • Assignee:
              Aslak Hellesøy
              Reporter:
              Miguel Paraz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: