-
Story
-
Resolution: Done
-
Critical
-
DO378 - RHBoQ2.13-en-1-20230228
-
4
-
ROLE
-
en-US (English)
URL: https://role.rhu.redhat.com/rol-rhu/app/courses/do378-2.13/pages/ch04s05
Reporter RHNID: ggastald
Section: 5 - Event-driven Architecture (EDA)
Language: en-US (English)||
Workaround:
Description: Issue 1
event.profile == "business" does not work in Java (unless the String is in an intern pool, which is not the case). Use "business".equals(event.profile) instead
In Java, when comparing strings for equality, it is recommended to use the equals() method instead of the == operator. The equals() method compares the actual contents of the strings, whereas the == operator checks for reference equality.
So, to compare the event.profile string with the value "business", you should use "business".equals(event.profile) as follows:
javaCopy code
{{if ("business".equals(event.profile))
}}
This ensures that the comparison is performed correctly, regardless of whether the strings are interned or not.
Issue 2
There is a missing closing parenthesis in the given code. The correct code should be:
Given code screenshot attached.
Correct javaCopy code
{{return Message.of(
high.await().atMost(Duration.ofSeconds(1)).doubleValue()
/
total.await().atMost(Duration.ofSeconds(1)).doubleValue()
);}}
Please ping me on the ticket for any further information regarding this.