You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/09/20 18:06:02 UTC

[39/47] phoenix git commit: PHOENIX-3291 Do not throw return value of Throwables#propagate call

PHOENIX-3291 Do not throw return value of Throwables#propagate call


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/553a5871
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/553a5871
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/553a5871

Branch: refs/heads/calcite
Commit: 553a5871e3c8e2277cebd9f2561b1f2899d1e6d5
Parents: 4c8bda1
Author: James Taylor <ja...@apache.org>
Authored: Fri Sep 16 21:25:00 2016 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Sat Sep 17 00:07:28 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java    | 6 ++++--
 .../apache/phoenix/mapreduce/FormatToBytesWritableMapper.java  | 3 ++-
 .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java  | 2 +-
 .../main/java/org/apache/phoenix/util/CSVCommonsLoader.java    | 2 +-
 .../java/org/apache/phoenix/util/PhoenixContextExecutor.java   | 6 +++---
 5 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 0c154e2..0fbc81a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -314,7 +314,8 @@ public class PhoenixStatement implements Statement, SQLCloseable {
                 }, PhoenixContextExecutor.inContext());
         } catch (Exception e) {
             Throwables.propagateIfInstanceOf(e, SQLException.class);
-            throw Throwables.propagate(e);
+            Throwables.propagate(e);
+            throw new IllegalStateException(); // Can't happen as Throwables.propagate() always throws
         }
     }
     
@@ -367,7 +368,8 @@ public class PhoenixStatement implements Statement, SQLCloseable {
                         Tracing.withTracing(connection, this.toString()));
         } catch (Exception e) {
             Throwables.propagateIfInstanceOf(e, SQLException.class);
-            throw Throwables.propagate(e);
+            Throwables.propagate(e);
+            throw new IllegalStateException(); // Can't happen as Throwables.propagate() always throws
         }
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
index cacbce7..b12326a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
+
 import javax.annotation.Nullable;
 
 import org.apache.hadoop.conf.Configuration;
@@ -379,7 +380,7 @@ public abstract class FormatToBytesWritableMapper<RECORD> extends Mapper<LongWri
             LOG.error("Error on record " + record, throwable);
             context.getCounter(COUNTER_GROUP_NAME, "Errors on records").increment(1L);
             if (!ignoreRecordErrors) {
-                throw Throwables.propagate(throwable);
+                Throwables.propagate(throwable);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 767a600..1aa9b88 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2786,7 +2786,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
             });
         } catch (Exception e) {
             Throwables.propagateIfInstanceOf(e, SQLException.class);
-            throw Throwables.propagate(e);
+            Throwables.propagate(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
index cdd9d7b..23f123e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java
@@ -292,7 +292,7 @@ public class CSVCommonsLoader {
         public void errorOnRecord(CSVRecord csvRecord, Throwable throwable) {
             LOG.error("Error upserting record " + csvRecord, throwable.getMessage());
             if (strict) {
-                throw Throwables.propagate(throwable);
+                Throwables.propagate(throwable);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/553a5871/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixContextExecutor.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixContextExecutor.java b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixContextExecutor.java
index 2da3249..cd12261 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixContextExecutor.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixContextExecutor.java
@@ -21,8 +21,6 @@ import java.util.concurrent.Callable;
 
 import org.apache.phoenix.call.CallWrapper;
 
-import com.google.common.base.Throwables;
-
 /**
  * Executes {@code Callable}s using a context classloader that is set up to load classes from
  * Phoenix.
@@ -91,8 +89,10 @@ public class PhoenixContextExecutor {
     public static <T> T callWithoutPropagation(Callable<T> target) {
         try {
             return call(target);
+        } catch (RuntimeException e) {
+            throw e;
         } catch (Exception e) {
-            throw Throwables.propagate(e);
+            throw new RuntimeException(e);
         }
     }