[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-21 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17856859#comment-17856859
 ] 

Werner Punz commented on MYFACES-4671:
--

I added the fix now to all 3 affected branches via the upstream project.

Also The fix is now the one with the Elvis operator usage!

 

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
> Fix For: 5.0.0, 4.0.3, 4.1.0-RC3
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-21 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17856857#comment-17856857
 ] 

Werner Punz commented on MYFACES-4671:
--

Btw the code can be written a little bit more tersely:
 
let message = JSON.parse(event?.data ?? null);
 
Typescript has an Elvis operator, so no need for explicity undefined checks 
anymore!

I will prepare a new version of the upstream codebase then we can easily get 
the new code into all branches!

 

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-18 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17856124#comment-17856124
 ] 

Werner Punz commented on MYFACES-4671:
--

Looks fine to me as well!

 

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4671) PushImpl.ts Socket#onerror attempting to use undefined variable

2024-06-18 Thread Volodymyr Siedlecki (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17856085#comment-17856085
 ] 

Volodymyr Siedlecki commented on MYFACES-4671:
--

The change looks fine to me. I've assigned it to Werner, so that he could also 
take a look. Thanks

> PushImpl.ts Socket#onerror attempting to use undefined variable
> ---
>
> Key: MYFACES-4671
> URL: https://issues.apache.org/jira/browse/MYFACES-4671
> Project: MyFaces Core
>  Issue Type: Bug
>Affects Versions: 4.0.2, 4.1.0-RC2
> Environment: OS: Windows 11
> Java version 17.0.7
>Reporter: Thomas Smith
>Assignee: Werner Punz
>Priority: Minor
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)|https://github.com/OpenLiberty/open-liberty/issues/27598]
> Proposed Solution: Change
> {code:java}
>  JSON.parse(event.data) {code}
> to
> {code:java}
> JSON.parse(event.data === undefined ? null : event.data){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)