Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-7089

Default InjectionProvider cannot handle overloaded methods with PostConstruct

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: EAP_EWP 5.1.1
    • Fix Version/s: EAP_EWP 5.1.2 ER1
    • Component/s: Web
    • Labels:
      None
    • Environment:

      JBoss EAP 5.1.1
      JSF 1.2

    • Steps to Reproduce:
      Hide

      Use the attached application to reproduce the error.
      1. Deploy it to EAP 5.1.1
      2. Access the managed bean at http://localhost:8080/jsfHello/

      Show
      Use the attached application to reproduce the error. 1. Deploy it to EAP 5.1.1 2. Access the managed bean at http://localhost:8080/jsfHello/
    • Workaround Description:
      Hide

      Use JBossInjectionProvider by adding the following to web.xml

      <context-param>
      <param-name>com.sun.faces.injectionProvider</param-name>
      <param-value>org.jboss.web.jsf.integration.injection.JBossInjectionProvider</param-value>
      </context-param>

      Or, do not overload the method.

      Show
      Use JBossInjectionProvider by adding the following to web.xml <context-param> <param-name>com.sun.faces.injectionProvider</param-name> <param-value>org.jboss.web.jsf.integration.injection.JBossInjectionProvider</param-value> </context-param> Or, do not overload the method.
    • Release Notes Text:
      Hide
      If there was a @PostConstruct annotation, or other annotation, on a method which was overloaded by another method with the same name, the call to that method would fail with an exception error. This occurred because no arguments were passed to the method and only the presence or absence of the method was being checked, not the presence or absence of methods. To resolve this issue further checks have been added so that the presence of parameters is confirmed prior to the method being invoked.
      Show
      If there was a @PostConstruct annotation, or other annotation, on a method which was overloaded by another method with the same name, the call to that method would fail with an exception error. This occurred because no arguments were passed to the method and only the presence or absence of the method was being checked, not the presence or absence of methods. To resolve this issue further checks have been added so that the presence of parameters is confirmed prior to the method being invoked.
    • Release Notes Docs Status:
      Documented as Resolved Issue
    • Docs QE Status:
      NEW

      Description

      When overloading a method with two implementations, like so:

      @PostConstruct
      public void init()

      { this.name = "init () no args"; }

      public String init(Object foo)

      { this.name = "init () with foo"; return null; }

      PostConstruct invocation fails with an error:

      2011-08-29 16:41:17,434 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jsfHello].[jsp]] (http-localhost%2F127.0.0.1-808
      0-2) Servlet.service() for servlet jsp threw exception
      java.lang.IllegalArgumentException: wrong number of arguments
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rmaucher Remy Maucherat
                Reporter:
                jshepher Jason Shepherd
                Writer:
                Russell Dickenson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: