accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo] branch master updated: Fix #976 - Expand overly broad Exceptions in hadoop-mapreduce (#1038)
Date Thu, 21 Mar 2019 17:18:52 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new f5b91a9  Fix #976 - Expand overly broad Exceptions in hadoop-mapreduce (#1038)
f5b91a9 is described below

commit f5b91a9877b485e4778ff48c31ad8629b159b989
Author: Christopher McTague <cjmctague@apache.org>
AuthorDate: Thu Mar 21 13:18:47 2019 -0400

    Fix #976 - Expand overly broad Exceptions in hadoop-mapreduce (#1038)
---
 .../org/apache/accumulo/hadoop/mapred/AccumuloOutputFormat.java   | 2 +-
 .../apache/accumulo/hadoop/mapreduce/AccumuloOutputFormat.java    | 2 +-
 .../apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java   | 8 +++++---
 .../apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java   | 2 +-
 .../accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java       | 8 +++++---
 .../accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java       | 2 +-
 .../accumulo/hadoopImpl/mapreduce/lib/MapReduceClientOpts.java    | 5 ++++-
 7 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormat.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormat.java
index cce542d..7ec3748 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormat.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormat.java
@@ -62,7 +62,7 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation>
{
       Progressable progress) throws IOException {
     try {
       return new AccumuloRecordWriter(job);
-    } catch (Exception e) {
+    } catch (RuntimeException e) {
       throw new IOException(e);
     }
   }
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormat.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormat.java
index 4c84211..4e3d84a 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormat.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormat.java
@@ -78,7 +78,7 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation>
{
       throws IOException {
     try {
       return new AccumuloRecordWriter(attempt);
-    } catch (Exception e) {
+    } catch (RuntimeException e) {
       throw new IOException(e);
     }
   }
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java
index 00076bd..0340649 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.ClientSideIteratorScanner;
 import org.apache.accumulo.core.client.IsolatedScanner;
@@ -157,7 +158,7 @@ public abstract class AccumuloRecordReader<K,V> implements RecordReader<K,V>
{
         if (classLoaderContext != null) {
           scanner.setClassLoaderContext(classLoaderContext);
         }
-      } catch (Exception e) {
+      } catch (TableNotFoundException e) {
         throw new IOException(e);
       }
 
@@ -198,7 +199,7 @@ public abstract class AccumuloRecordReader<K,V> implements RecordReader<K,V>
{
           scanner = new ClientSideIteratorScanner(scanner);
         }
         setupIterators(job, scanner, baseSplit);
-      } catch (Exception e) {
+      } catch (RuntimeException e) {
         throw new IOException(e);
       }
 
@@ -354,7 +355,8 @@ public abstract class AccumuloRecordReader<K,V> implements RecordReader<K,V>
{
               tl.invalidateCache();
             }
           }
-        } catch (Exception e) {
+        } catch (TableOfflineException | TableNotFoundException | AccumuloException
+            | AccumuloSecurityException e) {
           throw new IOException(e);
         }
 
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java
index c0371b3..12faa0f 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java
@@ -104,7 +104,7 @@ public class AccumuloRecordWriter implements RecordWriter<Text,Mutation>
{
     if (!bws.containsKey(table))
       try {
         addTable(table);
-      } catch (final Exception e) {
+      } catch (final AccumuloSecurityException | AccumuloException e) {
         log.error("Could not add table '" + table + "'", e);
         throw new IOException(e);
       }
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java
index 182d66b..c186e9e 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordReader.java
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.ClientSideIteratorScanner;
 import org.apache.accumulo.core.client.IsolatedScanner;
@@ -176,7 +177,7 @@ public abstract class AccumuloRecordReader<K,V> extends RecordReader<K,V>
{
         if (classLoaderContext != null) {
           scanner.setClassLoaderContext(classLoaderContext);
         }
-      } catch (Exception e) {
+      } catch (TableNotFoundException e) {
         e.printStackTrace();
         throw new IOException(e);
       }
@@ -219,7 +220,7 @@ public abstract class AccumuloRecordReader<K,V> extends RecordReader<K,V>
{
         }
 
         setupIterators(attempt, scanner, split);
-      } catch (Exception e) {
+      } catch (RuntimeException e) {
         throw new IOException(e);
       }
 
@@ -387,7 +388,8 @@ public abstract class AccumuloRecordReader<K,V> extends RecordReader<K,V>
{
               tl.invalidateCache();
             }
           }
-        } catch (Exception e) {
+        } catch (TableOfflineException | TableNotFoundException | AccumuloException
+            | AccumuloSecurityException e) {
           throw new IOException(e);
         }
 
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java
index 9818b7b..1057ac1 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java
@@ -105,7 +105,7 @@ public class AccumuloRecordWriter extends RecordWriter<Text,Mutation>
{
     if (!bws.containsKey(table))
       try {
         addTable(table);
-      } catch (Exception e) {
+      } catch (AccumuloSecurityException | AccumuloException e) {
         log.error("Could not add table '" + table + "'", e);
         throw new IOException(e);
       }
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/MapReduceClientOpts.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/MapReduceClientOpts.java
index b1cfdf8..fc686d7 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/MapReduceClientOpts.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/MapReduceClientOpts.java
@@ -16,11 +16,14 @@
  */
 package org.apache.accumulo.hadoopImpl.mapreduce.lib;
 
+import java.io.IOException;
 import java.util.Properties;
 
 import org.apache.accumulo.core.cli.ClientOpts;
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.admin.DelegationTokenConfig;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.KerberosToken;
@@ -78,7 +81,7 @@ public class MapReduceClientOpts extends ClientOpts {
           props.setProperty(ClientProperty.AUTH_PRINCIPAL.getKey(), newPrincipal);
           ClientProperty.setAuthenticationToken(props, token);
         }
-      } catch (Exception e) {
+      } catch (IOException | AccumuloException | AccumuloSecurityException e) {
         final String msg = "Failed to acquire DelegationToken for use with MapReduce";
         log.error(msg, e);
         throw new RuntimeException(msg, e);


Mime
View raw message