PicoContainer
  1. PicoContainer
  2. PICO-51

DefaultComponentAdapter fails with a null key

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-3
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      According the Jon Tirsen the following should work.

      MutablePicoContainer container = ...; // setup your containerDefaultComponentAdapter adapter = new DefaultComponentAdapter(null, SingleUseObject.class);SingleUseObject singleUseObject = (SingleUseObject) adapter.getComponentInstance(container);

      Unfortuantly the DefaultComponentAdapter fails with a null pointer.

      java.lang.NullPointerException: componentKey
      at org.picocontainer.defaults.AbstractComponentAdapter.<init>(AbstractComponentAdapter.java:19)
      at org.picocontainer.defaults.DefaultComponentAdapter.<init>(DefaultComponentAdapter.java:41)
      at org.picocontainer.defaults.DefaultComponentAdapter.<init>(DefaultComponentAdapter.java:53)

      The simple work around is to pass a key

        Activity

        Aslak Hellesøy made changes -
        Field Original Value New Value
        Status Unassigned [ 1 ] Assigned [ 2 ]
        Assignee Jon Tirsen [ tirsen ]
        Hide
        Aslak Hellesøy added a comment -

        Jon, where/why did you recommend registering components with a null key? Can we close this issue?

        Show
        Aslak Hellesøy added a comment - Jon, where/why did you recommend registering components with a null key? Can we close this issue?
        Jon Tirsen made changes -
        Status Assigned [ 2 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Jon Tirsen made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Jon Tirsen made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.0-beta-3 [ 10232 ]

          People

          • Assignee:
            Jon Tirsen
            Reporter:
            Kevin O'Neill
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: