Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4495

TCK: Application: subscribeToEvent, publishEvent, unsubscibeFromEvent don't throw NPEs when specified by the JavaDoc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.15, 2.3.10, 2.3-next-M7, 3.0.2, 4.0.0-RC2
    • 2.3.11, 3.0.3, 2.3-next-M8, 2.2.16, 4.0.0-RC3
    • General
    • None

    Description

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#subscribeToEvent(java.lang.Class,jakarta.faces.event.SystemEventListener)

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#subscribeToEvent(java.lang.Class,java.lang.Class,jakarta.faces.event.SystemEventListener)

      Throws: NullPointerException - if any combination of systemEventClass, or listener are null.

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#unsubscribeFromEvent(java.lang.Class,jakarta.faces.event.SystemEventListener)

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#unsubscribeFromEvent(java.lang.Class,java.lang.Class,jakarta.faces.event.SystemEventListener)

      Throws: NullPointerException - if any combination of context, systemEventClass, or listener are null.
      

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#publishEvent(jakarta.faces.context.FacesContext,java.lang.Class,java.lang.Class,java.lang.Object)

      Throws: NullPointerException - if any arguments except for sourceBaseType are null
      

      https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/application/application#publishEvent(jakarta.faces.context.FacesContext,java.lang.Class,java.lang.Object)

      Throws:
          NullPointerException - if either context, systemEventClass or source is null
      

      Given the data constructs that are used in these methods for MyFaces we happen to throw an NPE in some situations  but not all. I'll provide a PR that makes the NPEs more obvious and consistent.

       

      TCK Tests:

      1) https://github.com/jakartaee/faces/blob/4.0.1/tck/old-tck/source/src/com/sun/ts/tests/jsf/api/jakarta_faces/application/application/TestServlet.java#L2082

      2) https://github.com/jakartaee/faces/blob/4.0.1/tck/old-tck/source/src/com/sun/ts/tests/jsf/api/jakarta_faces/application/application/TestServlet.java#L2244

      3) https://github.com/jakartaee/faces/blob/4.0.1/tck/old-tck/source/src/com/sun/ts/tests/jsf/api/jakarta_faces/application/application/TestServlet.java#L2272

      Attachments

        Activity

          People

            paul.nicolucci Paul Nicolucci
            paul.nicolucci Paul Nicolucci
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: