You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/03/18 21:44:00 UTC

[incubator-streampipes-extensions] 01/03: STREAMPIPES-64: REST pull adapter exception

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git

commit 90a3133561841b624ff3f2588d7bb48d0a00e517
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Mar 17 22:50:32 2020 +0100

    STREAMPIPES-64: REST pull adapter exception
---
 .../apache/streampipes/connect/protocol/stream/PullProtocol.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/protocol/stream/PullProtocol.java b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/protocol/stream/PullProtocol.java
index e955f96..6527e54 100644
--- a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/protocol/stream/PullProtocol.java
+++ b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/protocol/stream/PullProtocol.java
@@ -27,6 +27,7 @@ import org.apache.streampipes.connect.adapter.model.generic.Protocol;
 import org.apache.streampipes.connect.adapter.model.pipeline.AdapterPipeline;
 
 import java.io.InputStream;
+import java.net.ConnectException;
 import java.util.concurrent.*;
 
 public abstract class PullProtocol extends Protocol {
@@ -64,8 +65,8 @@ public abstract class PullProtocol extends Protocol {
 
             format.reset();
             SendToPipeline stk = new SendToPipeline(format, adapterPipeline);
-            InputStream data = getDataFromEndpoint();
             try {
+                InputStream data = getDataFromEndpoint();
                 if(data != null) {
                     parser.parse(data, stk);
                 } else {
@@ -75,6 +76,7 @@ public abstract class PullProtocol extends Protocol {
                 logger.error("Error while parsing: " + e.getMessage());
             }
 
+
         };
 
         scheduler = Executors.newScheduledThreadPool(1);
@@ -93,5 +95,5 @@ public abstract class PullProtocol extends Protocol {
         scheduler.shutdownNow();
     }
 
-    abstract InputStream getDataFromEndpoint();
+    abstract InputStream getDataFromEndpoint() throws ParseException;
 }