Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.2 b4ce49dc3 -> a9e16799d


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/a9e16799
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a9e16799
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a9e16799

Branch: refs/heads/4.8-HBase-1.2
Commit: a9e16799d66aa1a44ab2fc0d003b7736de1c41e6
Parents: b4ce49d
Author: James Taylor <jamestay...@apache.org>
Authored: Fri Sep 16 21:25:00 2016 -0700
Committer: James Taylor <jamestay...@apache.org>
Committed: Mon Sep 19 08:13:59 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/a9e16799/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/a9e16799/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/a9e16799/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/a9e16799/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/a9e16799/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);
         }
     }
 

Reply via email to