Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/src/main/java/example/chat/StreamChatExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void main(String[] args) {
System.out.print(event.getMessage().getContent());
}
if (ChatEventType.CONVERSATION_CHAT_COMPLETED.equals(event.getEvent())) {
if (MessageType.FOLLOW_UP.equals(event.getMessage().getType())) {
if (event.getMessage() != null && MessageType.FOLLOW_UP.equals(event.getMessage().getType())) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Correct NPE fix, but address the formatting failure.

The null-check correctly prevents the NullPointerException described in the PR. The logic properly handles both cases: when a message exists with type FOLLOW_UP, and when the message is null (falling through to print token usage).

However, the pipeline indicates a Spotless formatting violation. Run mvn spotless:apply to fix the code style.

🤖 Prompt for AI Agents
In example/src/main/java/example/chat/StreamChatExample.java around line 61 the
null-check for event.getMessage() fixes the NPE but the file fails Spotless
formatting; run mvn spotless:apply (or your project's formatter) and commit the
formatted changes so the formatting violation is resolved.

System.out.println(event.getMessage().getContent());
} else {
System.out.println("Token usage:" + event.getChat().getUsage().getTokenCount());
Expand Down
Loading