You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/10/21 12:40:47 UTC

[myfaces-tobago] branch tobago-5.x updated: demo: fail tolerance for quarkus

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

lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new f144d85  demo: fail tolerance for quarkus
f144d85 is described below

commit f144d8556793d44bbd6f53751844b7b002d4b174
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Oct 21 14:37:22 2021 +0200

    demo: fail tolerance for quarkus
---
 .../org/apache/myfaces/tobago/example/demo/NavigationTree.java    | 8 +++++---
 .../tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
index 17918c6..13b2242 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
@@ -86,7 +86,7 @@ public class NavigationTree implements Serializable {
     Collections.sort(nodes);
 
     // after sorting the first node is the root node.
-    root = nodes.get(0);
+    root = nodes.size() > 0 ? nodes.get(0) : null;
 
     final Map<String, NavigationNode> map = new HashMap<>();
 
@@ -134,7 +134,7 @@ public class NavigationTree implements Serializable {
   }
 
   public NavigationNode findByViewId(final String viewId) {
-    if (viewId != null) {
+    if (viewId != null && root != null) {
       final Enumeration enumeration = root.depthFirstEnumeration();
       while (enumeration.hasMoreElements()) {
         final NavigationNode node = (NavigationNode) enumeration.nextElement();
@@ -153,8 +153,10 @@ public class NavigationTree implements Serializable {
   public void gotoNode(final NavigationNode node) {
     if (node != null) {
       events.fire(node);
-    } else {
+    } else if (root != null) {
       events.fire(root);
+    } else {
+      LOG.error("No navigation tree available!");
     }
   }
 
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
index 5d5f784..14ffd92 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
@@ -44,6 +44,9 @@
     <supported-theme>charlotteville</supported-theme>
   </theme-config>
 
+  <!-- currently you need to switch this check off for quarkus -->
+<!--  <check-session-secret>false</check-session-secret>-->
+
   <!-- This is needed for the testing functionality of the demo, it works with iframes -->
   <prevent-frame-attacks>false</prevent-frame-attacks>