Added null check to ObjectMessageProcessor
This commit is contained in:
parent
2813b54e32
commit
47ca47a761
@ -38,7 +38,12 @@ public class ObjectMessageProcessor implements IMessageProcessor {
|
|||||||
public void process(Message message, WriteProxy writeProxy) {
|
public void process(Message message, WriteProxy writeProxy) {
|
||||||
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(message.sharedArray, message.offset + 4, message.length - 4))) {
|
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(message.sharedArray, message.offset + 4, message.length - 4))) {
|
||||||
Object obj = in.readObject();
|
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
|
// Process object
|
||||||
processors.stream().filter(p -> p.getInputClass().isInstance(obj)).forEach((@SuppressWarnings("rawtypes") ObjectProcessor p) -> {
|
processors.stream().filter(p -> p.getInputClass().isInstance(obj)).forEach((@SuppressWarnings("rawtypes") ObjectProcessor p) -> {
|
||||||
|
Reference in New Issue
Block a user