Added null check to ObjectMessageProcessor

This commit is contained in:
delvh 2020-02-18 16:28:32 +01:00
parent ea6d76757e
commit e673c4e242

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) -> {