You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2018/12/30 20:44:42 UTC

[incubator-plc4x] branch develop updated: [CALCITE] Fixed sonar issues.

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

jfeinauer pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1f2778b  [CALCITE] Fixed sonar issues.
1f2778b is described below

commit 1f2778bab5ae6a2a9b0250640214bf59901425a5
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Dec 30 21:22:25 2018 +0100

    [CALCITE] Fixed sonar issues.
---
 integrations/apache-calcite/pom.xml                                 | 6 ++++++
 .../src/main/java/org/apache/plc4x/Plc4xBaseTable.java              | 5 +++--
 .../apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java  | 4 +++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/integrations/apache-calcite/pom.xml b/integrations/apache-calcite/pom.xml
index 4fef5af..45b8da7 100644
--- a/integrations/apache-calcite/pom.xml
+++ b/integrations/apache-calcite/pom.xml
@@ -51,6 +51,12 @@
     </dependency>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
       <artifactId>plc4j-scraper</artifactId>
       <version>0.3.0-SNAPSHOT</version>
       <scope>compile</scope>
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java b/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
index 9514492..7437b42 100644
--- a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
+++ b/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
@@ -28,6 +28,7 @@ import org.apache.calcite.rel.type.RelDataTypeFactory;
 import org.apache.calcite.schema.Statistic;
 import org.apache.calcite.schema.impl.AbstractTable;
 import org.apache.calcite.util.ImmutableBitSet;
+import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.scraper.config.JobConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -102,9 +103,9 @@ public abstract class Plc4xBaseTable extends AbstractTable {
             first = future.get(5, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
-            throw new RuntimeException("Thread was interrupted!", e);
+            throw new PlcRuntimeException("Thread was interrupted!", e);
         } catch (ExecutionException | TimeoutException e) {
-            throw new RuntimeException("Unable to fetch first record and infer arguments!");
+            throw new PlcRuntimeException("Unable to fetch first record and infer arguments!", e);
         }
         logger.info("Inferring types for Table '{}' based on values: {}", conf.getName(), first.values);
         // Extract types
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java b/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
index 9e38bfc..1511a06 100644
--- a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
+++ b/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
@@ -20,6 +20,7 @@ package org.apache.plc4x;
 
 import org.apache.calcite.schema.Table;
 import org.apache.calcite.schema.impl.AbstractSchema;
+import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.scraper.ResultHandler;
 import org.apache.plc4x.java.scraper.Scraper;
 import org.apache.plc4x.java.scraper.config.JobConfiguration;
@@ -93,7 +94,8 @@ public class Plc4xSchema extends AbstractSchema {
                 Record record = new Record(Instant.now(), alias, results);
                 queues.get(job).put(record);
             } catch (InterruptedException e) {
-                e.printStackTrace();
+                Thread.currentThread().interrupt();
+                throw new PlcRuntimeException("Handling got interrupted", e);
             }
         }