Skip to content

Commit 623bb5e

Browse files
committed
updated WritingByteBuffer.java
1 parent 8935876 commit 623bb5e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/de/javasocketapi/core/WritingByteBuffer.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public void writeChar(final char value) {
5252
}
5353

5454
public void writeString(final String value) {
55+
//check value
56+
checkInput(value);
5557
//writing string
5658
int length = value.length();
5759
this.writeInt(length);
@@ -61,6 +63,8 @@ public void writeString(final String value) {
6163
}
6264

6365
public void writeUUID(final UUID value) {
66+
//check value
67+
checkInput(value);
6468
//writing uuid
6569
this.writeString(value.toString());
6670
}
@@ -70,4 +74,11 @@ public byte[] toBytes() {
7074
return this.byteBuf.toBytes();
7175
}
7276

77+
private void checkInput(Object o) {
78+
//check o to not be null
79+
if (o == null) {
80+
throw new IllegalStateException("The object to be sent may not be null.");
81+
}
82+
}
83+
7384
}

0 commit comments

Comments
 (0)