Skip to content

Commit ba65703

Browse files
senivamjansupol
authored andcommitted
JerseySseEventSource#register throws IllegalStateException (#3892)
Signed-off-by: Maxim Nesen <[email protected]>
1 parent 14b674a commit ba65703

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

media/sse/src/main/java/org/glassfish/jersey/media/sse/internal/JerseySseEventSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private void subscribe(final Consumer<Flow.Subscription> onSubscribe,
122122
final Consumer<Throwable> onError,
123123
final Runnable onComplete) {
124124
if (onSubscribe == null || onEvent == null || onError == null || onComplete == null) {
125-
throw new IllegalStateException(LocalizationMessages.PARAMS_NULL());
125+
throw new IllegalArgumentException(LocalizationMessages.PARAMS_NULL());
126126
}
127127

128128
publisher.subscribe(new Flow.Subscriber<InboundSseEvent>() {

tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/sse/GenericEntityTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ public void testGenericList() throws InterruptedException {
106106
}
107107
}
108108

109+
110+
@Test(expected = IllegalArgumentException.class)
111+
public void testRegisterNull() {
112+
final SseEventSource source = SseEventSource.target(target("genericentityresource/string")).build();
113+
source.register(null);
114+
}
115+
109116
@Singleton
110117
@Path("genericentityresource")
111118
public static class SSEGenericEntityResource {

0 commit comments

Comments
 (0)