From bde3c4ac79be34d04608630cecc88ed14085957c Mon Sep 17 00:00:00 2001 From: sourabhpoddar404 Date: Thu, 28 Nov 2019 20:03:24 +0100 Subject: [PATCH] Code changes to handle null delivery issue #45 --- .../core/components/AbstractEvaluationModule.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/hobbit/core/components/AbstractEvaluationModule.java b/src/main/java/org/hobbit/core/components/AbstractEvaluationModule.java index 7f8d202..e97d464 100644 --- a/src/main/java/org/hobbit/core/components/AbstractEvaluationModule.java +++ b/src/main/java/org/hobbit/core/components/AbstractEvaluationModule.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.concurrent.TimeUnit; - import org.apache.commons.io.IOUtils; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; @@ -124,8 +123,12 @@ protected void collectResponses() throws Exception { //Wait for delivery message Delivery delivery = consumer.getDeliveryQueue().poll(QUEUEPOLLTIMEOUT, TimeUnit.MILLISECONDS); // parse the response - try + if (delivery == null) { + LOGGER.error("No Message Received after waiting for ten minutes"); + return; + } + buffer = ByteBuffer.wrap(delivery.getBody()); @@ -151,11 +154,7 @@ protected void collectResponses() throws Exception { evaluateResponse(expectedData, receivedData, taskSentTimestamp, responseReceivedTimestamp); - }catch(NullPointerException e) - { - LOGGER.error("No Message Received after waiting for ten minutes"); - } } }