Skip to content

Commit 249f669

Browse files
committed
Fixed closeframe test
1 parent 7ea71ac commit 249f669

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/main/java/org/java_websocket/framing/CloseFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public String toString() {
235235
@Override
236236
public void isValid() throws InvalidDataException {
237237
super.isValid();
238-
if (code == CloseFrame.NO_UTF8 && reason == null) {
238+
if (code == CloseFrame.NO_UTF8 && reason.isEmpty()) {
239239
throw new InvalidDataException( CloseFrame.NO_UTF8, "Received text is no valid utf8 string!");
240240
}
241241
if (code == CloseFrame.NOCODE && 0 < reason.length()) {

src/test/java/org/java_websocket/framing/CloseFrameTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ public void testIsValid() {
138138
} catch (InvalidDataException e) {
139139
//fine
140140
}
141-
frame.setCode(CloseFrame.NO_UTF8);
142-
try {
143-
frame.isValid();
144-
} catch (InvalidDataException e) {
145-
fail("InvalidDataException should not be thrown");
146-
}
147141
frame.setCode(CloseFrame.POLICY_VALIDATION);
148142
try {
149143
frame.isValid();

0 commit comments

Comments
 (0)