PicoContainer
  1. PicoContainer
  2. PICO-174

Registering Too Many Parameters Throws NPE

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0-beta-5
    • Fix Version/s: 1.0-RC-1
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This test case demonstrates:

      import org.picocontainer.defaults.DefaultPicoContainer;
      import org.picocontainer.defaults.ConstantParameter;
      import org.picocontainer.Parameter;

      import junit.framework.TestCase;

      public class PicoTestCase extends TestCase {

      public void testRegisteringTooManyParametersThrowsNPE() {
      // reproduced with pico beta 5
      DefaultPicoContainer pico = new DefaultPicoContainer();

      pico.registerComponentImplementation(DeleteMe.Component.class, DeleteMe.Component.class, new Parameter[]

      { new ConstantParameter("one") }

      );

      System.out.println(pico.getComponentInstance(DeleteMe.Component.class));

      }

      public static final class Component {
      }
      }

        Activity

        Hide
        Konstantin Pribluda added a comment -

        You surely mean too much components?

        Show
        Konstantin Pribluda added a comment - You surely mean too much components?
        Hide
        Konstantin Pribluda added a comment -

        I can not reproduce this issue off current CVS state.
        I used this testcase:

        public void testPico174() {
        MutablePicoContainer pico = new DefaultPicoContainer();

        pico.registerComponentImplementation(MyComponent.class,
        MyComponent.class,
        new Parameter[]

        { new ConstantParameter("foo") }

        );

        try

        { pico.getComponentInstance(Component.class); fail("was not bombed on unsatisfied constructor dependency"); }

        catch(PicoInitializationException ex) {
        }
        }
        public final static class MyComponent {
        }

        and build went fine and threw PicoInitializationException as expected.

        Show
        Konstantin Pribluda added a comment - I can not reproduce this issue off current CVS state. I used this testcase: public void testPico174() { MutablePicoContainer pico = new DefaultPicoContainer(); pico.registerComponentImplementation(MyComponent.class, MyComponent.class, new Parameter[] { new ConstantParameter("foo") } ); try { pico.getComponentInstance(Component.class); fail("was not bombed on unsatisfied constructor dependency"); } catch(PicoInitializationException ex) { } } public final static class MyComponent { } and build went fine and threw PicoInitializationException as expected.
        Konstantin Pribluda made changes -
        Field Original Value New Value
        Resolution Cannot Reproduce [ 5 ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.0-RC-1 [ 10461 ]
        Assignee Konstantin Pribluda [ ko5tik ]

          People

          • Assignee:
            Konstantin Pribluda
            Reporter:
            Mike Hogan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: