File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/de/javasocketapi/core Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments