Added null check to ObjectMessageProcessor

This commit is contained in:
delvh 2020-02-18 16:28:32 +01:00
parent 2813b54e32
commit 47ca47a761
1 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,12 @@ public class ObjectMessageProcessor implements IMessageProcessor {
public void process(Message message, WriteProxy writeProxy) {
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(message.sharedArray, message.offset + 4, message.length - 4))) {
Object obj = in.readObject();
System.out.println("Read object: " + obj.toString());
if (obj == null) {
System.out.println("received a null object");
return;
}
System.out.println("Read object: " + obj);
// Process object
processors.stream().filter(p -> p.getInputClass().isInstance(obj)).forEach((@SuppressWarnings("rawtypes") ObjectProcessor p) -> {