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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • EAP_EWP 5.1.2 ER1
    • EAP_EWP 5.1.1
    • Web
    • None
    • JBoss EAP 5.1.1
      JSF 1.2

    • 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/
    • 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.
    • 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.
    • Documented as Resolved Issue
    • 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)

      Attachments

        Activity

          People

            rmaucher Remy Maucherat
            rhn-support-jshepher Jason Shepherd
            Russell Dickenson Russell Dickenson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: