File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/main/java/ch/rasc/sse/eventbus Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,10 @@ public SseEventBuilder createSseEventBuilder() {
5858 this .event .comment ().ifPresent (sseBuilder ::comment );
5959
6060 if (this .convertedValue != null ) {
61- for (String line : this .convertedValue .split ("\n " )) {
62- sseBuilder .data (line );
63- }
61+ addStringData (sseBuilder , this .convertedValue );
6462 }
65- else if (this .event .data () instanceof String ) {
66- for (String line : ((String ) this .event .data ()).split ("\n " )) {
67- sseBuilder .data (line );
68- }
63+ else if (this .event .data () instanceof String stringData ) {
64+ addStringData (sseBuilder , stringData );
6965 }
7066 else {
7167 sseBuilder .data (this .event .data ());
@@ -75,6 +71,12 @@ else if (this.event.data() instanceof String) {
7571
7672 }
7773
74+ private static void addStringData (SseEventBuilder sseBuilder , String value ) {
75+ for (String line : value .split ("\n " )) {
76+ sseBuilder .data (line );
77+ }
78+ }
79+
7880 void incErrorCounter () {
7981 this .errorCounter ++;
8082 }
You can’t perform that action at this time.
0 commit comments