PicoContainer
  1. PicoContainer
  2. PICO-157

CICA always reports all dependencies instead of only the missing ones

    Details

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

      Description

      Hey, (sorry my ssh cvs is broken around here somehow and I don't got the time to fix it yet.)

      The current ConstructorInjectionComponentAdapter will always report all dependencies as unstatisfiable even if only one is missing. Just a quick patch will fix. I'll apply it when I get my ssh cvs fixed (should be by the weekend) or go ahead if you got a little moment.

      ? patch.txt
      Index: src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java
      ===================================================================
      RCS file: /cvsroot/picocontainer/java/picocontainer/src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java,v
      retrieving revision 1.3
      diff -b -u -r1.3 ConstructorInjectionComponentAdapter.java
      — src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 12 Mar 2004 11:26:19 -0000 1.3
      +++ src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 24 Mar 2004 15:51:09 -0000
      @@ -103,7 +103,7 @@
      ComponentAdapter adapter = currentParameters[j].resolveAdapter(getContainer(), parameterTypes[j]);
      if (adapter == null)

      { failedDependency = true; - unsatisfiableDependencyTypes.add(Arrays.asList(parameterTypes)); + unsatisfiableDependencyTypes.add(parameterTypes[j]); }

      else {
      // we can't depend on ourself
      if (adapter.equals(this)) {

        Issue Links

          Activity

          Hide
          Aslak Hellesøy added a comment -

          Done. I had to amend some tests too.

          Show
          Aslak Hellesøy added a comment - Done. I had to amend some tests too.
          Aslak Hellesøy made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Hide
          Jörg Schaible added a comment -

          Just a heads-up. This was explicitly introduced with PICO-134.

          Show
          Jörg Schaible added a comment - Just a heads-up. This was explicitly introduced with PICO-134 .
          Hide
          Aslak Hellesøy added a comment -

          So I guess PICO-134 and PICO-157 are in conflict then. Which one should we keep?

          Show
          Aslak Hellesøy added a comment - So I guess PICO-134 and PICO-157 are in conflict then. Which one should we keep?
          Hide
          Thomas Heller added a comment -

          Maybe we should add the tried constructor to the message so that we can see which constructor was tried and which dependency failed.

          In my particular issue my component only had once constructor with 3 args and only one dependency couldn't be found I've been rather confused why he kept telling me which one was missing and actually I was looking in the wrong places due to that.

          Show
          Thomas Heller added a comment - Maybe we should add the tried constructor to the message so that we can see which constructor was tried and which dependency failed. In my particular issue my component only had once constructor with 3 args and only one dependency couldn't be found I've been rather confused why he kept telling me which one was missing and actually I was looking in the wrong places due to that.
          Hide
          Konstantin Pribluda added a comment -

          I'm +1 on better and understandeable reporting. It may become extremely difficult to hunt down missing dependency in 3 ( or more ) levels of containers, when there are aout 50 components in total.
          ( like my portal, i do not have 50 components yet, but it's definitely heading that way... I'm reworking applications and services to pico - about 50 % done. )

          And since I'm really busy, I have to delegate portal configuration and testing to people with lesser programming experience, so clear message to them is extremely important )

          Show
          Konstantin Pribluda added a comment - I'm +1 on better and understandeable reporting. It may become extremely difficult to hunt down missing dependency in 3 ( or more ) levels of containers, when there are aout 50 components in total. ( like my portal, i do not have 50 components yet, but it's definitely heading that way... I'm reworking applications and services to pico - about 50 % done. ) And since I'm really busy, I have to delegate portal configuration and testing to people with lesser programming experience, so clear message to them is extremely important )
          Hide
          Jörg Schaible added a comment -

          Well, since this is "just" the message of our own exception, that is normally only thrown during development, nobody stops us from adding both elements of information to the message:

          Unsatisfied dependency "BType" in ctor arguments ["AType", "BType", "String"]

          WDYT?

          Show
          Jörg Schaible added a comment - Well, since this is "just" the message of our own exception, that is normally only thrown during development, nobody stops us from adding both elements of information to the message: Unsatisfied dependency "BType" in ctor arguments ["AType", "BType", "String"] WDYT?
          Hide
          Thomas Heller added a comment -

          For me its only important to know which dependency was missing as everything else that didn't get reported seems fine so I don't care about it at that time.

          I'm fine with extending the message to include which constructors were tried but honestly I don't see the need for it. (Maybe cause my components usually only got 1 ctor

          As long as its clear which component is missing I'm +1.

          Show
          Thomas Heller added a comment - For me its only important to know which dependency was missing as everything else that didn't get reported seems fine so I don't care about it at that time. I'm fine with extending the message to include which constructors were tried but honestly I don't see the need for it. (Maybe cause my components usually only got 1 ctor As long as its clear which component is missing I'm +1.
          Hide
          Jörg Schaible added a comment -

          Implement better readability of exception as proposed.

          Show
          Jörg Schaible added a comment - Implement better readability of exception as proposed.
          Jörg Schaible made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Assignee Thomas Heller [ maniax ] Joerg Schaible [ joehni ]
          Resolution Fixed [ 1 ]
          Jörg Schaible made changes -
          Link This issue duplicates PICO-223 [ PICO-223 ]
          Mauro Talevi made changes -
          Component/s PicoContainer (Java) [ 10191 ]
          Fix Version/s 1.2 [ 11330 ]
          Environment
          Description Hey, (sorry my ssh cvs is broken around here somehow and I don't got the time to fix it yet.)

          The current ConstructorInjectionComponentAdapter will always report all dependencies as unstatisfiable even if only one is missing. Just a quick patch will fix. I'll apply it when I get my ssh cvs fixed (should be by the weekend) or go ahead if you got a little moment.


          ? patch.txt
          Index: src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java
          ===================================================================
          RCS file: /cvsroot/picocontainer/java/picocontainer/src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java,v
          retrieving revision 1.3
          diff -b -u -r1.3 ConstructorInjectionComponentAdapter.java
          --- src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 12 Mar 2004 11:26:19 -0000 1.3
          +++ src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 24 Mar 2004 15:51:09 -0000
          @@ -103,7 +103,7 @@
                           ComponentAdapter adapter = currentParameters[j].resolveAdapter(getContainer(), parameterTypes[j]);
                           if (adapter == null) {
                               failedDependency = true;
          - unsatisfiableDependencyTypes.add(Arrays.asList(parameterTypes));
          + unsatisfiableDependencyTypes.add(parameterTypes[j]);
                           } else {
                               // we can't depend on ourself
                               if (adapter.equals(this)) {
          Hey, (sorry my ssh cvs is broken around here somehow and I don't got the time to fix it yet.)

          The current ConstructorInjectionComponentAdapter will always report all dependencies as unstatisfiable even if only one is missing. Just a quick patch will fix. I'll apply it when I get my ssh cvs fixed (should be by the weekend) or go ahead if you got a little moment.


          ? patch.txt
          Index: src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java
          ===================================================================
          RCS file: /cvsroot/picocontainer/java/picocontainer/src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java,v
          retrieving revision 1.3
          diff -b -u -r1.3 ConstructorInjectionComponentAdapter.java
          --- src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 12 Mar 2004 11:26:19 -0000 1.3
          +++ src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 24 Mar 2004 15:51:09 -0000
          @@ -103,7 +103,7 @@
                           ComponentAdapter adapter = currentParameters[j].resolveAdapter(getContainer(), parameterTypes[j]);
                           if (adapter == null) {
                               failedDependency = true;
          - unsatisfiableDependencyTypes.add(Arrays.asList(parameterTypes));
          + unsatisfiableDependencyTypes.add(parameterTypes[j]);
                           } else {
                               // we can't depend on ourself
                               if (adapter.equals(this)) {
          Jörg Schaible made changes -
          Environment
          Fix Version/s 1.2 [ 11330 ]
          Fix Version/s 1.3 [ 11331 ]
          Mauro Talevi made changes -
          Assignee Joerg Schaible [ joehni ] Mauro Talevi [ maurotalevi ]
          Mauro Talevi made changes -
          Fix Version/s 1.2 [ 11330 ]
          Fix Version/s 1.3 [ 11331 ]
          Description Hey, (sorry my ssh cvs is broken around here somehow and I don't got the time to fix it yet.)

          The current ConstructorInjectionComponentAdapter will always report all dependencies as unstatisfiable even if only one is missing. Just a quick patch will fix. I'll apply it when I get my ssh cvs fixed (should be by the weekend) or go ahead if you got a little moment.


          ? patch.txt
          Index: src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java
          ===================================================================
          RCS file: /cvsroot/picocontainer/java/picocontainer/src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java,v
          retrieving revision 1.3
          diff -b -u -r1.3 ConstructorInjectionComponentAdapter.java
          --- src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 12 Mar 2004 11:26:19 -0000 1.3
          +++ src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 24 Mar 2004 15:51:09 -0000
          @@ -103,7 +103,7 @@
                           ComponentAdapter adapter = currentParameters[j].resolveAdapter(getContainer(), parameterTypes[j]);
                           if (adapter == null) {
                               failedDependency = true;
          - unsatisfiableDependencyTypes.add(Arrays.asList(parameterTypes));
          + unsatisfiableDependencyTypes.add(parameterTypes[j]);
                           } else {
                               // we can't depend on ourself
                               if (adapter.equals(this)) {
          Hey, (sorry my ssh cvs is broken around here somehow and I don't got the time to fix it yet.)

          The current ConstructorInjectionComponentAdapter will always report all dependencies as unstatisfiable even if only one is missing. Just a quick patch will fix. I'll apply it when I get my ssh cvs fixed (should be by the weekend) or go ahead if you got a little moment.


          ? patch.txt
          Index: src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java
          ===================================================================
          RCS file: /cvsroot/picocontainer/java/picocontainer/src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java,v
          retrieving revision 1.3
          diff -b -u -r1.3 ConstructorInjectionComponentAdapter.java
          --- src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 12 Mar 2004 11:26:19 -0000 1.3
          +++ src/java/org/picocontainer/defaults/ConstructorInjectionComponentAdapter.java 24 Mar 2004 15:51:09 -0000
          @@ -103,7 +103,7 @@
                           ComponentAdapter adapter = currentParameters[j].resolveAdapter(getContainer(), parameterTypes[j]);
                           if (adapter == null) {
                               failedDependency = true;
          - unsatisfiableDependencyTypes.add(Arrays.asList(parameterTypes));
          + unsatisfiableDependencyTypes.add(parameterTypes[j]);
                           } else {
                               // we can't depend on ourself
                               if (adapter.equals(this)) {
          Type Bug [ 1 ] Improvement [ 4 ]
          Hide
          Mauro Talevi added a comment -

          Added constructor to UnsatisfiableDependenciesException with the unsatisfied type.

          Show
          Mauro Talevi added a comment - Added constructor to UnsatisfiableDependenciesException with the unsatisfied type.
          Mauro Talevi made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Mauro Talevi
              Reporter:
              Thomas Heller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: