Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 d1241a09c -> 878a264e5


http://git-wip-us.apache.org/repos/asf/phoenix/blob/878a264e/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
index bc2b625..cd23dc5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -119,25 +119,6 @@ public class ServerUtil {
         }
         return new PhoenixIOException(t);
     }
-
-    /**
-     * Return the first SQLException in the exception chain, otherwise parse 
it.
-     * When we're receiving an exception locally, there's no need to string 
parse,
-     * as the SQLException will already be part of the chain.
-     * @param t
-     * @return the SQLException, or null if none found
-     */
-    public static SQLException parseLocalOrRemoteServerException(Throwable t) {
-        while (t.getCause() != null) {
-            if (t instanceof NotServingRegionException) {
-                return parseRemoteException(new 
StaleRegionBoundaryCacheException());
-            } else if (t instanceof SQLException) {
-                return (SQLException) t;
-            }
-            t = t.getCause();
-        }
-        return parseRemoteException(t);
-    }
     
     public static SQLException parseServerExceptionOrNull(Throwable t) {
         while (t.getCause() != null) {
@@ -215,7 +196,7 @@ public class ServerUtil {
         return parseTimestampFromRemoteException(t);
     }
 
-    public static long parseTimestampFromRemoteException(Throwable t) {
+    private static long parseTimestampFromRemoteException(Throwable t) {
         String message = t.getLocalizedMessage();
         if (message != null) {
             // If the message matches the standard pattern, recover the 
SQLException and throw it.
@@ -235,7 +216,7 @@ public class ServerUtil {
             msg = "";
         }
         if (t instanceof SQLException) {
-            msg = t.getMessage() + " " + msg;
+            msg = constructSQLErrorMessage((SQLException) t, msg);
         }
         msg += String.format(FORMAT_FOR_TIMESTAMP, timestamp);
         return new DoNotRetryIOException(msg, t);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/878a264e/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestIndexWriter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestIndexWriter.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestIndexWriter.java
index 918c411..b0e3780 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestIndexWriter.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestIndexWriter.java
@@ -105,10 +105,6 @@ public class TestIndexWriter {
     Configuration conf =new Configuration();
     Mockito.when(e.getConfiguration()).thenReturn(conf);
     Mockito.when(e.getSharedData()).thenReturn(new 
ConcurrentHashMap<String,Object>());
-    Region mockRegion = Mockito.mock(Region.class);
-    Mockito.when(e.getRegion()).thenReturn(mockRegion);
-    HTableDescriptor mockTableDesc = Mockito.mock(HTableDescriptor.class);
-    Mockito.when(mockRegion.getTableDesc()).thenReturn(mockTableDesc);
     ExecutorService exec = Executors.newFixedThreadPool(1);
     Map<ImmutableBytesPtr, HTableInterface> tables = new 
HashMap<ImmutableBytesPtr, HTableInterface>();
     FakeTableFactory factory = new FakeTableFactory(tables);
@@ -165,10 +161,6 @@ public class TestIndexWriter {
     Configuration conf =new Configuration();
     Mockito.when(e.getConfiguration()).thenReturn(conf);
     Mockito.when(e.getSharedData()).thenReturn(new 
ConcurrentHashMap<String,Object>());
-    Region mockRegion = Mockito.mock(Region.class);
-    Mockito.when(e.getRegion()).thenReturn(mockRegion);
-    HTableDescriptor mockTableDesc = Mockito.mock(HTableDescriptor.class);
-    Mockito.when(mockRegion.getTableDesc()).thenReturn(mockTableDesc);
     FakeTableFactory factory = new FakeTableFactory(tables);
 
     byte[] tableName = this.testName.getTableName();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/878a264e/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java
index bfe1d0d..3e2b47c 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java
@@ -30,13 +30,11 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
-import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.Stoppable;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.phoenix.hbase.index.StubAbortable;
@@ -95,10 +93,6 @@ public class TestParalleIndexWriter {
     Configuration conf =new Configuration();
     Mockito.when(e.getConfiguration()).thenReturn(conf);
     Mockito.when(e.getSharedData()).thenReturn(new 
ConcurrentHashMap<String,Object>());
-    Region mockRegion = Mockito.mock(Region.class);
-    Mockito.when(e.getRegion()).thenReturn(mockRegion);
-    HTableDescriptor mockTableDesc = Mockito.mock(HTableDescriptor.class);
-    Mockito.when(mockRegion.getTableDesc()).thenReturn(mockTableDesc);
     ImmutableBytesPtr tableName = new 
ImmutableBytesPtr(this.test.getTableName());
     Put m = new Put(row);
     m.add(Bytes.toBytes("family"), Bytes.toBytes("qual"), null);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/878a264e/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java
index 6f0881b..32a6661 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java
@@ -30,13 +30,11 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
-import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.Stoppable;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.phoenix.hbase.index.StubAbortable;
@@ -90,10 +88,6 @@ public class TestParalleWriterIndexCommitter {
     Configuration conf =new Configuration();
     Mockito.when(e.getConfiguration()).thenReturn(conf);
     Mockito.when(e.getSharedData()).thenReturn(new 
ConcurrentHashMap<String,Object>());
-    Region mockRegion = Mockito.mock(Region.class);
-    Mockito.when(e.getRegion()).thenReturn(mockRegion);
-    HTableDescriptor mockTableDesc = Mockito.mock(HTableDescriptor.class);
-    Mockito.when(mockRegion.getTableDesc()).thenReturn(mockTableDesc);
     Stoppable stop = Mockito.mock(Stoppable.class);
     ExecutorService exec = Executors.newFixedThreadPool(1);
     Map<ImmutableBytesPtr, HTableInterface> tables =

Reply via email to