You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2013/06/17 01:11:41 UTC

svn commit: r1493606 - in /gora/trunk: CHANGES.txt gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java

Author: lewismc
Date: Sun Jun 16 23:11:40 2013
New Revision: 1493606

URL: http://svn.apache.org/r1493606
Log:
GORA-230 Change logging behavior in AccumuloStore to pass exception object to LOG.error method.

Modified:
    gora/trunk/CHANGES.txt
    gora/trunk/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java

Modified: gora/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/gora/trunk/CHANGES.txt?rev=1493606&r1=1493605&r2=1493606&view=diff
==============================================================================
--- gora/trunk/CHANGES.txt (original)
+++ gora/trunk/CHANGES.txt Sun Jun 16 23:11:40 2013
@@ -4,6 +4,8 @@
 
 Gora Change Log
 
+* GORA-230 Change logging behavior in AccumuloStore to pass exception object to LOG.error method. (David Medinets via lewismc)
+
 * GORA-185 Remove ANT scripts and IVY confs (lewismc)
 
 * GORA-243 Properly escaping spaces of GORA_HOME in bin/gora (Apostolos Giannakidis via lewismc)

Modified: gora/trunk/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java?rev=1493606&r1=1493605&r2=1493606&view=diff
==============================================================================
--- gora/trunk/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java (original)
+++ gora/trunk/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java Sun Jun 16 23:11:40 2013
@@ -281,8 +281,7 @@ public class AccumuloStore<K,T extends P
         throw new IOException(e);
       }
     }catch(IOException e){
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     }
   }
   
@@ -344,7 +343,7 @@ public class AccumuloStore<K,T extends P
 
       return mapping;
     } catch (Exception ex) {
-      throw new IOException(ex);
+      throw new IOException("Unable to read " + filename, ex);
     }
 
   }
@@ -364,14 +363,11 @@ public class AccumuloStore<K,T extends P
       }
 
     } catch (AccumuloException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } catch (AccumuloSecurityException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } catch (TableExistsException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     }
   }
 
@@ -383,14 +379,11 @@ public class AccumuloStore<K,T extends P
       batchWriter = null;
       conn.tableOperations().delete(mapping.tableName);
     } catch (AccumuloException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } catch (AccumuloSecurityException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } catch (TableNotFoundException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } 
   }
 
@@ -511,12 +504,10 @@ public class AccumuloStore<K,T extends P
         return null;
       return persistent;
     } catch (TableNotFoundException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return null;
     } catch (IOException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return null;
     }
   }
@@ -608,12 +599,10 @@ public class AccumuloStore<K,T extends P
         try {
           getBatchWriter().addMutation(m);
         } catch (MutationsRejectedException e) {
-          LOG.error(e.getMessage());
-          LOG.error(e.getStackTrace().toString());
+          LOG.error(e.getMessage(), e);
         }
     } catch (IOException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     }
   }
   
@@ -652,16 +641,13 @@ public class AccumuloStore<K,T extends P
       return count;
     } catch (TableNotFoundException e) {
       // TODO return 0?
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return 0;
     } catch (MutationsRejectedException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return 0;
     } catch (IOException e){
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return 0;
     }
   }
@@ -707,8 +693,7 @@ public class AccumuloStore<K,T extends P
       return new AccumuloResult<K,T>(this, query, scanner);
     } catch (TableNotFoundException e) {
       // TODO return empty result?
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
       return null;
     } 
   }
@@ -872,8 +857,7 @@ public class AccumuloStore<K,T extends P
         batchWriter.flush();
       }
     } catch (MutationsRejectedException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } 
   }
 
@@ -885,8 +869,7 @@ public class AccumuloStore<K,T extends P
         batchWriter = null;
       }
     } catch (MutationsRejectedException e) {
-      LOG.error(e.getMessage());
-      LOG.error(e.getStackTrace().toString());
+      LOG.error(e.getMessage(), e);
     } 
   }
 }