gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [2/4] gora git commit: GORA-429 Implement Maven forbidden-apis plugin in Gora v2
Date Tue, 01 Sep 2015 20:44:20 GMT
GORA-429 Implement Maven forbidden-apis plugin in Gora v2


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/606b79d7
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/606b79d7
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/606b79d7

Branch: refs/heads/master
Commit: 606b79d762a456970cdd6b846f63b28a65a19bfa
Parents: a303ff7
Author: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Authored: Tue Sep 1 12:29:28 2015 -0700
Committer: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Committed: Tue Sep 1 12:29:28 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/gora/accumulo/store/AccumuloStore.java  | 5 ++++-
 .../org/apache/gora/cassandra/store/CassandraStore.java     | 1 +
 .../java/org/apache/gora/compiler/utils/LicenseHeaders.java | 9 +++++++++
 .../java/org/apache/gora/mapreduce/GoraRecordReader.java    | 3 ++-
 .../java/org/apache/gora/mapreduce/GoraRecordWriter.java    | 8 ++++----
 .../apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java  | 7 +++++++
 .../apache/gora/store/ws/impl/WSBackedDataStoreBase.java    | 6 ++++++
 gora-core/src/main/java/org/apache/gora/util/ByteUtils.java | 7 +++++++
 gora-goraci/src/main/java/org/apache/gora/goraci/Print.java | 2 +-
 .../src/main/java/org/apache/gora/goraci/Verify.java        | 2 +-
 .../src/main/java/org/apache/gora/goraci/Walker.java        | 1 +
 .../org/apache/gora/hbase/util/TestHBaseByteInterface.java  | 6 ++++++
 .../src/main/java/org/apache/gora/solr/store/SolrStore.java | 2 ++
 13 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
index 1333bb2..601992c 100644
--- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
+++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
@@ -141,7 +141,8 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T
         } else {
           data = decoder.readBytes(null).array();
         }
-      } catch (IOException e) {;
+      } catch (IOException e) {
+        LOG.error(e.getMessage());
         throw new GoraException("Error decoding union type: ", e);
       }
     } else {
@@ -216,6 +217,7 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T
 
       throw new IllegalArgumentException("Unknown type " + clazz.getName());
     } catch (IOException ioe) {
+      LOG.error(ioe.getMessage());
       throw new RuntimeException(ioe);
     }
   }
@@ -247,6 +249,7 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T
         avroEncoder.flush();
         return baos.toByteArray();
       } catch (IOException e) {
+        LOG.error(e.getMessage());
         return toBytes(o);
       }
     } else {

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
----------------------------------------------------------------------
diff --git a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
index 0e5bfbf..98deb9a 100644
--- a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
+++ b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
@@ -342,6 +342,7 @@ public class CassandraStore<K, T extends PersistentBase> extends
DataStoreBase<K
     try {
       hasResult = result.next();
     } catch (Exception e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
     return hasResult ? result.get() : null;

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-compiler/src/main/java/org/apache/gora/compiler/utils/LicenseHeaders.java
----------------------------------------------------------------------
diff --git a/gora-compiler/src/main/java/org/apache/gora/compiler/utils/LicenseHeaders.java
b/gora-compiler/src/main/java/org/apache/gora/compiler/utils/LicenseHeaders.java
index b573346..6428e36 100644
--- a/gora-compiler/src/main/java/org/apache/gora/compiler/utils/LicenseHeaders.java
+++ b/gora-compiler/src/main/java/org/apache/gora/compiler/utils/LicenseHeaders.java
@@ -19,6 +19,9 @@ package org.apache.gora.compiler.utils;
 
 import java.util.HashMap;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /** 
  * Utility class which specifies a collection of license headers which can be 
  * used within the GoraCompiler for generating alternative license headers for
@@ -26,6 +29,8 @@ import java.util.HashMap;
  */
 public class LicenseHeaders {
 
+  private static final Logger LOG = LoggerFactory.getLogger(LicenseHeaders.class);
+
   /**
    * Chosen license to be included within the generated classes
    */
@@ -230,12 +235,16 @@ public class LicenseHeaders {
           relatedLicenses.put(licenseValue,var);
         }
     } catch (SecurityException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     } catch (NoSuchFieldException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     } catch (IllegalArgumentException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     } catch (IllegalAccessException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordReader.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordReader.java b/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordReader.java
index c15ed2f..bff05ab 100644
--- a/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordReader.java
+++ b/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordReader.java
@@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
  * An adapter for Result to Hadoop RecordReader.
  */
 public class GoraRecordReader<K, T extends PersistentBase> extends RecordReader<K,T>
{
+
   public static final Logger LOG = LoggerFactory.getLogger(GoraRecordReader.class);
 
   public static final String BUFFER_LIMIT_READ_NAME = "gora.buffer.read.limit";
@@ -119,7 +120,7 @@ public class GoraRecordReader<K, T extends PersistentBase> extends
RecordReader<
 	    return this.result.next();
 	  }
 	  catch(Exception e){
-	    LOG.error("Error reading Gora records");
+	    LOG.error("Error reading Gora records: {}", e.getMessage());
 	    throw new RuntimeException(e);
 	  }
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordWriter.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordWriter.java b/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordWriter.java
index f23d5f8..f399ee0 100644
--- a/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordWriter.java
+++ b/gora-core/src/main/java/org/apache/gora/mapreduce/GoraRecordWriter.java
@@ -55,8 +55,8 @@ public class GoraRecordWriter<K, T> extends RecordWriter<K, T>
{
     try{
       store.close();
     }catch(Exception e){
-      LOG.warn("Exception at GoraRecordWriter.class while closing datastore." + e.getMessage());
-      LOG.warn("Trace: " + e.getStackTrace());
+      LOG.warn("Exception at GoraRecordWriter.class while closing datastore: {}", e.getMessage());
+      LOG.warn("Trace: {}", e.getStackTrace());
       throw new RuntimeException(e);
     }
   }
@@ -71,8 +71,8 @@ public class GoraRecordWriter<K, T> extends RecordWriter<K, T>
{
         store.flush();
       }
     }catch(Exception e){
-      LOG.warn("Exception at GoraRecordWriter.class while writing to datastore. " + e.getMessage());
-      LOG.warn("Trace: " + e.getStackTrace());
+      LOG.warn("Exception at GoraRecordWriter.class while writing to datastore: {}", e.getMessage());
+      LOG.warn("Trace: {}", e.getStackTrace());
       throw new RuntimeException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-core/src/main/java/org/apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java
b/gora-core/src/main/java/org/apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java
index 56df668..376150c 100644
--- a/gora-core/src/main/java/org/apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java
+++ b/gora-core/src/main/java/org/apache/gora/persistency/ws/impl/BeanFactoryWSImpl.java
@@ -24,6 +24,9 @@ import org.apache.gora.persistency.BeanFactory;
 import org.apache.gora.persistency.Persistent;
 import org.apache.gora.util.ReflectionUtils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * A default implementation of the {@link BeanFactory} interface. Constructs 
  * the keys using by reflection, {@link Persistent} objects by calling 
@@ -31,6 +34,8 @@ import org.apache.gora.util.ReflectionUtils;
  */
 public class BeanFactoryWSImpl<K, T extends Persistent> implements BeanFactory<K,
T> {
 
+    private static final Logger LOG = LoggerFactory.getLogger(BeanFactoryWSImpl.class);
+
   /**
    * Class of the key to be used
    */
@@ -107,8 +112,10 @@ public class BeanFactoryWSImpl<K, T extends Persistent> implements
BeanFactory<K
     try {
       return (T) persistentClass.newInstance();
     } catch (InstantiationException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     } catch (IllegalAccessException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
b/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
index 7cd93b9..a62425a 100644
--- a/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
+++ b/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
@@ -27,12 +27,17 @@ import org.apache.gora.query.Result;
 import org.apache.gora.store.WebServiceBackedDataStore;
 import org.apache.gora.util.OperationNotSupportedException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Base implementations for {@link WebServiceBackedDataStore} methods.
  */
 public abstract class WSBackedDataStoreBase<K, T extends Persistent>
   extends WSDataStoreBase<K, T> implements WebServiceBackedDataStore<K, T> {
 
+  private static final Logger LOG = LoggerFactory.getLogger(WSBackedDataStoreBase.class);
+
   @Override
   /**
    * Initializes a web service backed data store
@@ -51,6 +56,7 @@ public abstract class WSBackedDataStoreBase<K, T extends Persistent>
     try {
       return executeQuery(query);
     } catch (IOException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-core/src/main/java/org/apache/gora/util/ByteUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/util/ByteUtils.java b/gora-core/src/main/java/org/apache/gora/util/ByteUtils.java
index 5acabc4..a382680 100644
--- a/gora-core/src/main/java/org/apache/gora/util/ByteUtils.java
+++ b/gora-core/src/main/java/org/apache/gora/util/ByteUtils.java
@@ -31,6 +31,9 @@ import org.apache.avro.specific.SpecificRecord;
 import org.apache.avro.util.Utf8;
 import org.apache.hadoop.io.WritableUtils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 //  This code is copied almost directly from HBase project's Bytes class.
 /**
  * Utility class that handles byte arrays, conversions to/from other types.
@@ -38,6 +41,8 @@ import org.apache.hadoop.io.WritableUtils;
  */
 public class ByteUtils {
 
+  private static final Logger LOG = LoggerFactory.getLogger(ByteUtils.class);
+
   /**
    * Size of boolean in bytes
    */
@@ -151,6 +156,7 @@ public class ByteUtils {
     try {
       result = new String(b, off, len, "UTF-8");
     } catch (UnsupportedEncodingException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
     return result;
@@ -168,6 +174,7 @@ public class ByteUtils {
     try {
       result = s.getBytes("UTF-8");
     } catch (UnsupportedEncodingException e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
     return result;

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-goraci/src/main/java/org/apache/gora/goraci/Print.java
----------------------------------------------------------------------
diff --git a/gora-goraci/src/main/java/org/apache/gora/goraci/Print.java b/gora-goraci/src/main/java/org/apache/gora/goraci/Print.java
index 372c1fc..417a5e4 100644
--- a/gora-goraci/src/main/java/org/apache/gora/goraci/Print.java
+++ b/gora-goraci/src/main/java/org/apache/gora/goraci/Print.java
@@ -58,7 +58,7 @@ public class Print extends Configured implements Tool {
         throw new ParseException("Command takes no arguments");
       }
     } catch (ParseException e) {
-      LOG.error("Failed to parse command line " + e.getMessage());
+      LOG.error("Failed to parse command line {}", e.getMessage());
       HelpFormatter formatter = new HelpFormatter();
       formatter.printHelp(getClass().getSimpleName(), options);
       System.exit(-1);

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
----------------------------------------------------------------------
diff --git a/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java b/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
index 83271a4..582e2e9 100644
--- a/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
+++ b/gora-goraci/src/main/java/org/apache/gora/goraci/Verify.java
@@ -170,7 +170,7 @@ public class Verify extends Configured implements Tool {
         throw new ParseException("Did not see expected # of arguments, saw " + cmd.getArgs().length);
       }
     } catch (ParseException e) {
-      LOG.error("Failed to parse command line " + e.getMessage());
+      LOG.error("Failed to parse command line {}", e.getMessage());
       HelpFormatter formatter = new HelpFormatter();
       formatter.printHelp(getClass().getSimpleName() + " <output dir> <num reducers>",
options);
       System.exit(-1);

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-goraci/src/main/java/org/apache/gora/goraci/Walker.java
----------------------------------------------------------------------
diff --git a/gora-goraci/src/main/java/org/apache/gora/goraci/Walker.java b/gora-goraci/src/main/java/org/apache/gora/goraci/Walker.java
index d6a0bad..a263cdb 100644
--- a/gora-goraci/src/main/java/org/apache/gora/goraci/Walker.java
+++ b/gora-goraci/src/main/java/org/apache/gora/goraci/Walker.java
@@ -117,6 +117,7 @@ public class Walker extends Configured implements Tool {
         return rs.get();
       }
     } catch (Exception e) {
+      LOG.error(e.getMessage());
       throw new RuntimeException(e);
     }
     

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
b/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
index 834fdd3..0ad0471 100644
--- a/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
+++ b/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
@@ -37,8 +37,13 @@ import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class TestHBaseByteInterface {
 
+  private static final Logger LOG = LoggerFactory.getLogger(TestHBaseByteInterface.class);
+
   private static final Random RANDOM = new Random(0);
 
   @Test
@@ -101,6 +106,7 @@ public class TestHBaseByteInterface {
             // everything ok, return 0
             return 0;
           } catch (Exception e) {
+            LOG.error(e.getMessage());
             throw new RuntimeException(e);
             // this will fail the test
           }

http://git-wip-us.apache.org/repos/asf/gora/blob/606b79d7/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
----------------------------------------------------------------------
diff --git a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
index cc38fa5..3a83d78 100644
--- a/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
+++ b/gora-solr/src/main/java/org/apache/gora/solr/store/SolrStore.java
@@ -246,11 +246,13 @@ public class SolrStore<K, T extends PersistentBase> extends DataStoreBase<K,
T>
       try {
         this.adminServer = new LBHttpSolrServer(solrUrlElements);
       } catch (MalformedURLException e) {
+        LOG.error(e.getMessage());
         throw new RuntimeException(e);
       }
       try {
         this.server = new LBHttpSolrServer( solrUrlElements + "/" + mapping.getCoreName()
);
       } catch (MalformedURLException e) {
+        LOG.error(e.getMessage());
         throw new RuntimeException(e);
       }
       if (serverUserAuth) {


Mime
View raw message