accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject git commit: ACCUMULO-1616 Replace occurances of Class.getCanonicalName() with Class.getName() for correctness and for consistency in log messages.
Date Thu, 25 Jul 2013 21:01:10 GMT
Updated Branches:
  refs/heads/master 260b43188 -> 98b2a0bc5


ACCUMULO-1616 Replace occurances of Class.getCanonicalName() with
Class.getName() for correctness and for consistency in log messages.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/98b2a0bc
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/98b2a0bc
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/98b2a0bc

Branch: refs/heads/master
Commit: 98b2a0bc50c62700a38c88ce0354c31d2d642fbf
Parents: 260b431
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Jul 25 17:00:17 2013 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Jul 25 17:00:17 2013 -0400

----------------------------------------------------------------------
 .../mapreduce/lib/util/ConfiguratorBase.java    |  2 +-
 .../accumulo/core/file/BloomFilterLayer.java    |  8 ++++--
 .../security/crypto/CryptoModuleFactory.java    | 29 ++++++++++----------
 .../org/apache/accumulo/core/util/Merge.java    |  2 +-
 .../minicluster/MiniAccumuloCluster.java        |  2 +-
 .../security/handler/ZKAuthenticator.java       |  5 ++--
 .../randomwalk/security/WalkingSecurity.java    |  2 +-
 .../test/functional/HalfDeadTServerIT.java      | 27 +++++++++---------
 8 files changed, 40 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
index 31964e8..b15b6a2 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
@@ -111,7 +111,7 @@ public class ConfiguratorBase {
     ArgumentChecker.notNull(principal, token);
     conf.setBoolean(enumToConfKey(implementingClass, ConnectorInfo.IS_CONFIGURED), true);
     conf.set(enumToConfKey(implementingClass, ConnectorInfo.PRINCIPAL), principal);
-    conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN_CLASS), token.getClass().getCanonicalName());
+    conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN_CLASS), token.getClass().getName());
     conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), CredentialHelper.tokenAsBase64(token));
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
index 2636126..111aab2 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/BloomFilterLayer.java
@@ -139,7 +139,7 @@ public class BloomFilterLayer {
         return;
       
       DataOutputStream out = writer.createMetaStore(BLOOM_FILE_NAME);
-      out.writeUTF(transformer.getClass().getCanonicalName());
+      out.writeUTF(transformer.getClass().getName());
       bloomFilter.write(out);
       out.flush();
       out.close();
@@ -186,6 +186,7 @@ public class BloomFilterLayer {
       loadThreshold = acuconf.getCount(Property.TABLE_BLOOM_LOAD_THRESHOLD);
       
       loadTask = new Runnable() {
+        @Override
         public void run() {
           
           // no need to load the bloom filter if the map file is closed
@@ -280,8 +281,8 @@ public class BloomFilterLayer {
     }
     
     /**
-     * Checks if this {@link RFile} contains keys from this range. The membership test is
performed using a Bloom filter, so the result has always non-zero probability of
-     * false positives.
+     * Checks if this {@link RFile} contains keys from this range. The membership test is
performed using a Bloom filter, so the result has always non-zero
+     * probability of false positives.
      * 
      * @param range
      *          range of keys to check
@@ -341,6 +342,7 @@ public class BloomFilterLayer {
       }
     }
     
+    @Override
     public synchronized void close() throws IOException {
       bfl.close();
       reader.close();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
b/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
index 40f2c1e..6b7b193 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/CryptoModuleFactory.java
@@ -89,7 +89,7 @@ public class CryptoModuleFactory {
         
       } catch (InstantiationException e) {
         log.warn(String.format("Got instantiation exception %s when instantiating crypto
module \"%s\".  No encryption will be used.", e.getCause().getClass()
-            .getCanonicalName(), cryptoModuleClassname));
+            .getName(), cryptoModuleClassname));
         log.warn(e.getCause());
         return new NullCryptoModule();
       } catch (IllegalAccessException e) {
@@ -149,7 +149,7 @@ public class CryptoModuleFactory {
         
       } catch (InstantiationException e) {
         log.warn(String.format("Got instantiation exception %s when instantiating secret
key encryption strategy \"%s\".  No encryption will be used.", e
-            .getCause().getClass().getCanonicalName(), className));
+            .getCause().getClass().getName(), className));
         log.warn(e.getCause());
         return new NullSecretKeyEncryptionStrategy();
       } catch (IllegalAccessException e) {
@@ -172,7 +172,7 @@ public class CryptoModuleFactory {
       
       return params;
     }
-
+    
     @Override
     public CryptoModuleParameters decryptSecretKey(CryptoModuleParameters params) {
       params.setPlaintextKey(params.getEncryptedKey());
@@ -188,24 +188,24 @@ public class CryptoModuleFactory {
       params.setEncryptedOutputStream(params.getPlaintextOutputStream());
       return params;
     }
-
+    
     @Override
     public CryptoModuleParameters getDecryptingInputStream(CryptoModuleParameters params)
throws IOException {
       params.setPlaintextInputStream(params.getEncryptedInputStream());
       return params;
     }
-
+    
     @Override
     public CryptoModuleParameters generateNewRandomSessionKey(CryptoModuleParameters params)
{
       params.setPlaintextKey(new byte[0]);
       return params;
     }
-
+    
     @Override
     public CryptoModuleParameters initializeCipher(CryptoModuleParameters params) {
       return params;
     }
-
+    
   }
   
   public static String[] parseCipherTransform(String cipherTransform) {
@@ -215,7 +215,6 @@ public class CryptoModuleFactory {
     
     return cipherTransform.split("/");
   }
-
   
   public static CryptoModuleParameters createParamsObjectFromAccumuloConfiguration(AccumuloConfiguration
conf) {
     
@@ -223,12 +222,12 @@ public class CryptoModuleFactory {
     Map<String,String> cryptoOpts = conf.getAllPropertiesWithPrefix(Property.CRYPTO_PREFIX);
     cryptoOpts.putAll(conf.getAllPropertiesWithPrefix(Property.INSTANCE_PREFIX));
     CryptoModuleParameters params = new CryptoModuleParameters();
-
+    
     return fillParamsObjectFromStringMap(params, cryptoOpts);
   }
-
+  
   public static CryptoModuleParameters fillParamsObjectFromStringMap(CryptoModuleParameters
params, Map<String,String> cryptoOpts) {
-
+    
     // Parse the cipher suite for the mode and padding options
     String[] cipherTransformParts = parseCipherTransform(cryptoOpts.get(Property.CRYPTO_CIPHER_SUITE.getKey()));
     
@@ -241,18 +240,18 @@ public class CryptoModuleFactory {
     
     params.setAllOptions(cryptoOpts);
     
-    // 
+    //
     params.setAlgorithmName(cryptoOpts.get(Property.CRYPTO_CIPHER_ALGORITHM_NAME.getKey()));
     params.setEncryptionMode(cipherTransformParts[1]);
     params.setKeyEncryptionStrategyClass(cryptoOpts.get(Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey()));
     params.setKeyLength(Integer.parseInt(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_LENGTH.getKey())));
-    params.setOverrideStreamsSecretKeyEncryptionStrategy(Boolean.parseBoolean(cryptoOpts.get(Property.CRYPTO_OVERRIDE_KEY_STRATEGY_WITH_CONFIGURED_STRATEGY.getKey())));
+    params.setOverrideStreamsSecretKeyEncryptionStrategy(Boolean.parseBoolean(cryptoOpts.get(Property.CRYPTO_OVERRIDE_KEY_STRATEGY_WITH_CONFIGURED_STRATEGY
+        .getKey())));
     params.setPadding(cipherTransformParts[2]);
     params.setRandomNumberGenerator(cryptoOpts.get(Property.CRYPTO_SECURE_RNG.getKey()));
     params.setRandomNumberGeneratorProvider(cryptoOpts.get(Property.CRYPTO_SECURE_RNG_PROVIDER.getKey()));
-
+    
     return params;
   }
-
   
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/core/src/main/java/org/apache/accumulo/core/util/Merge.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/Merge.java b/core/src/main/java/org/apache/accumulo/core/util/Merge.java
index b1d0205..350ccc0 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/Merge.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/Merge.java
@@ -85,7 +85,7 @@ public class Merge {
   
   public void start(String[] args) throws MergeException, ParseException {
     Opts opts = new Opts();
-    opts.parseArgs(Merge.class.getCanonicalName(), args);
+    opts.parseArgs(Merge.class.getName(), args);
     
     try {
       Connector conn = opts.getConnector();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 24dcb39..7657326 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -142,7 +142,7 @@ public class MiniAccumuloCluster {
     
     classpath = config.getConfDir().getAbsolutePath() + File.pathSeparator + classpath;
     
-    String className = clazz.getCanonicalName();
+    String className = clazz.getName();
     
     ArrayList<String> argList = new ArrayList<String>();
     argList.addAll(Arrays.asList(javaBin, "-Dproc=" + clazz.getSimpleName(), "-cp", classpath));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
index 3ea1c88..4e327ec 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
@@ -53,6 +53,7 @@ public final class ZKAuthenticator implements Authenticator {
     zooCache = new ZooCache();
   }
   
+  @Override
   public void initialize(String instanceId, boolean initialize) {
     ZKUserPath = Constants.ZROOT + "/" + instanceId + "/users";
   }
@@ -205,9 +206,9 @@ public final class ZKAuthenticator implements Authenticator {
     cs.add(PasswordToken.class);
     return cs;
   }
-
+  
   @Override
   public boolean validTokenClass(String tokenClass) {
-    return tokenClass.equals(PasswordToken.class.getCanonicalName());
+    return tokenClass.equals(PasswordToken.class.getName());
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
index 9cff8f7..cc08c0e 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
@@ -398,7 +398,7 @@ public class WalkingSecurity extends SecurityOperation implements Authorizor,
Au
   
   @Override
   public boolean validTokenClass(String tokenClass) {
-    return tokenClass.equals(PasswordToken.class.getCanonicalName());
+    return tokenClass.equals(PasswordToken.class.getName());
   }
   
   public static void clearInstance() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/98b2a0bc/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
b/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
index 4ea5bf0..506615c 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
@@ -62,6 +62,7 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
       rdr = new BufferedReader(new InputStreamReader(is));
       output = new StringBuilder();
     }
+    
     @Override
     public void run() {
       try {
@@ -84,13 +85,12 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
     }
   }
   
-  
-  @Test(timeout=100*1000)
+  @Test(timeout = 100 * 1000)
   public void testRecover() throws Exception {
     test(10);
   }
   
-  @Test(timeout=120*1000)
+  @Test(timeout = 120 * 1000)
   public void testTimeout() throws Exception {
     String results = test(40);
     if (results != null)
@@ -108,7 +108,7 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
     String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
     String classpath = System.getProperty("java.class.path");
     classpath = new File(cluster.getConfig().getDir(), "conf") + File.pathSeparator + classpath;
-    String className = TabletServer.class.getCanonicalName();
+    String className = TabletServer.class.getName();
     ArrayList<String> argList = new ArrayList<String>();
     argList.addAll(Arrays.asList(javaBin, "-cp", classpath));
     argList.addAll(Arrays.asList(Main.class.getName(), className));
@@ -131,25 +131,26 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
     UtilWaitThread.sleep(1000);
     c.tableOperations().create("test_ingest");
     assertEquals(1, c.instanceOperations().getTabletServers().size());
-    int rows = 100*1000;
-    Process ingest = cluster.exec(TestIngest.class, "-u", "root", "-i", cluster.getInstanceName(),
"-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--rows", rows + "");
+    int rows = 100 * 1000;
+    Process ingest = cluster.exec(TestIngest.class, "-u", "root", "-i", cluster.getInstanceName(),
"-z", cluster.getZooKeepers(), "-p", ROOT_PASSWORD,
+        "--rows", rows + "");
     UtilWaitThread.sleep(500);
     
     // block I/O with some side-channel trickiness
     File trickFile = new File(trickFilename);
     trickFile.createNewFile();
-    UtilWaitThread.sleep(seconds*1000);
+    UtilWaitThread.sleep(seconds * 1000);
     trickFile.delete();
-
+    
     if (seconds <= 10) {
       assertEquals(0, ingest.waitFor());
       VerifyIngest.Opts vopts = new VerifyIngest.Opts();
       vopts.rows = rows;
       VerifyIngest.verifyIngest(c, vopts, SOPTS);
     } else {
-      UtilWaitThread.sleep(5*1000);
+      UtilWaitThread.sleep(5 * 1000);
     }
-    // verify the process was blocked 
+    // verify the process was blocked
     String results = t.toString();
     assertTrue(results.contains("sleeping\nsleeping\nsleeping\n"));
     assertTrue(results.contains("Zookeeper error, will retry"));
@@ -160,7 +161,7 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
     t.join();
     return results;
   }
-
+  
   private boolean makeDiskFailureLibrary() throws Exception {
     String root = System.getProperty("user.dir");
     String source = root + "/src/test/c/fake_disk_failure.c";
@@ -168,9 +169,9 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
     String platform = System.getProperty("os.name");
     String cmd[];
     if (platform.equals("Darwin")) {
-      cmd = new String[]{"gcc","-arch","x86_64","-arch","i386","-dynamiclib","-O3","-fPIC",
source,"-o",lib};
+      cmd = new String[] {"gcc", "-arch", "x86_64", "-arch", "i386", "-dynamiclib", "-O3",
"-fPIC", source, "-o", lib};
     } else {
-      cmd = new String[]{"gcc","-D_GNU_SOURCE","-Wall","-fPIC", source,"-shared", "-o", lib,
"-ldl"};
+      cmd = new String[] {"gcc", "-D_GNU_SOURCE", "-Wall", "-fPIC", source, "-shared", "-o",
lib, "-ldl"};
     }
     Process gcc = Runtime.getRuntime().exec(cmd);
     return gcc.waitFor() == 0;


Mime
View raw message