accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [1/3] git commit: ACCUMULO-2728 Ensure rand int is positive for VolumeUtil
Date Wed, 23 Apr 2014 22:21:12 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 9621701fd -> 0d10bda87
  refs/heads/master 7492d7478 -> 3c40b529b


ACCUMULO-2728 Ensure rand int is positive for VolumeUtil


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 0d10bda874240ddc8ead68d850b46e4f48566634
Parents: 9621701
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Apr 23 18:14:42 2014 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Apr 23 18:14:42 2014 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/0d10bda8/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
index 2ef438f..34abb01 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java
@@ -52,6 +52,7 @@ import org.apache.log4j.Logger;
 public class VolumeUtil {
 
   private static final Logger log = Logger.getLogger(VolumeUtil.class);
+  private static final SecureRandom rand = new SecureRandom();
 
   private static boolean isActiveVolume(Path dir) {
 
@@ -157,7 +158,6 @@ public class VolumeUtil {
     }
   }
 
-
   public static Text switchRootTabletVolume(KeyExtent extent, Text location) throws IOException
{
     if (extent.isRootTablet()) {
       String newLocation = switchVolume(location.toString(), FileType.TABLE, ServerConstants.getVolumeReplacements());
@@ -344,8 +344,7 @@ public class VolumeUtil {
   }
 
   private static Path getBackupName(FileSystem fs, Path path) {
-    SecureRandom rand = new SecureRandom();
-    return new Path(path.getParent(), path.getName() + "_" + System.currentTimeMillis() +
"_" + Math.abs(rand.nextInt()) + ".bak");
+    return new Path(path.getParent(), path.getName() + "_" + System.currentTimeMillis() +
"_" + (rand.nextInt(Integer.MAX_VALUE) + 1) + ".bak");
   }
 
 }


Mime
View raw message