Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-0.98 f6e101f4a -> c20e2b66d


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

Branch: refs/heads/4.8-HBase-0.98
Commit: c20e2b66db08151fd3cc226f48cd2620fe02b7e8
Parents: f6e101f
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:17:27 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/c20e2b66/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 5e0f53c..a7b2587 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
@@ -311,7 +311,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
         }
     }
     
@@ -364,7 +365,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/c20e2b66/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/c20e2b66/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 0dd341b..3fd812f 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
@@ -2783,7 +2783,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/c20e2b66/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/c20e2b66/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