This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch fix-flux-jsyaml-v5-empty-doc
in repository https://gitbox.apache.org/repos/asf/storm.git

commit 34663d165f3353cd43a024ade27a5848a83f0699
Author: Richard Zowalla <[email protected]>
AuthorDate: Wed Jul 1 15:41:54 2026 +0200

    fix(webapp): guard Flux viewer against js-yaml 5.x empty-input throw
    
    js-yaml 5.x changed load('') to throw a YAMLException ('expected a
    document, but the input is empty') instead of returning undefined (see
    js-yaml migrate_v4_to_v5). The Flux Topology Viewer calls
    parseAndRender() on page load while the textarea holds only a comment
    (# YAML Definition), so jsyaml.load() now throws before the existing
    if(doc==null) guard, surfacing as an uncaught exception that fails the
    cypress-e2e suite (flux-page.cy.js).
    
    Wrap the load in try/catch and treat empty/comment-only or malformed
    input as 'no document'. Also broaden cypress-tests.yml to run on 2.x so
    this class of webapp regression is exercised there too (2.x already
    shipped js-yaml 5.2.0 and carries the same latent bug).
---
 .github/workflows/cypress-tests.yml                              | 4 ++--
 .../src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html   | 9 ++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/cypress-tests.yml 
b/.github/workflows/cypress-tests.yml
index fc2c6007e..50b71368c 100644
--- a/.github/workflows/cypress-tests.yml
+++ b/.github/workflows/cypress-tests.yml
@@ -17,11 +17,11 @@ name: Cypress E2E Tests
 
 on:
   push:
-    branches: [ "master" ]
+    branches: [ "master", "2.x" ]
     paths:
       - 'storm-webapp/**'
   pull_request:
-    branches: [ "master" ]
+    branches: [ "master", "2.x" ]
     paths:
       - 'storm-webapp/**'
   workflow_dispatch:
diff --git 
a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html 
b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
index ad676c17a..9d8699921 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
@@ -70,7 +70,14 @@
 
       function parseAndRender() {
         var input = document.getElementById('taInput').value;
-        var doc = jsyaml.load(input);
+        var doc;
+        try {
+          doc = jsyaml.load(input);
+        } catch (e) {
+          // js-yaml >=5 throws on empty/comment-only input instead of
+          // returning undefined (see migrate_v4_to_v5); treat as no document.
+          return;
+        }
        if(doc==null){
           return;
        }

Reply via email to