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

PushImpl.ts Socket#onerror attempting to use undefined variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0.2, 4.1.0-RC2
    • 5.0.0, 4.0.3, 4.1.0-RC3
    • None
    • None
    • OS: Windows 11
      Java version 17.0.7

    Description

      While running some OpenLiberty FAT tests, specifically io.openliberty.org.apache.myfaces.4.0_fat/WebSocketTests, we discovered a small bug where JSON.parse(event.data) was running where event.data was undefined.
      Here is the line it occurs: https://github.com/apache/myfaces/blob/dae36dde5cc42208d034dda23107ad79f68ecc3a/api/src/client/typescript/faces/impl/PushImpl.ts#L156
      Volodymyr created a GitHub issue describing the issue here: Faces 4.0 Fix WebSocketTests so that "onerror listener" occurs - Issue #27598 - OpenLiberty/open-liberty (github.com)

      Proposed Solution: Change

       JSON.parse(event.data) 

      to

      JSON.parse(event.data === undefined ? null : event.data)

      Attachments

        Issue Links

          Activity

            People

              werpu Werner Punz
              tssmith04 Thomas Smith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified