You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/01/31 05:01:55 UTC
[03/10] git commit: Lots of Constants.UTF8 usages on String
constructor and toBytes() calls
Lots of Constants.UTF8 usages on String constructor and toBytes() calls
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cbf8a9fa
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cbf8a9fa
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cbf8a9fa
Branch: refs/heads/2292-findbugs
Commit: cbf8a9fa3578eab71a236d0b4eb45f941aab3476
Parents: a11dae7
Author: Josh Elser <el...@apache.org>
Authored: Thu Jan 30 16:04:08 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jan 30 17:19:28 2014 -0500
----------------------------------------------------------------------
.../accumulo/core/client/ZooKeeperInstance.java | 8 +++---
.../client/admin/InstanceOperationsImpl.java | 2 +-
.../core/client/admin/TableOperationsImpl.java | 30 ++++++++++----------
3 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/cbf8a9fa/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 46a7307..5197262 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -164,13 +164,13 @@ public class ZooKeeperInstance implements Instance {
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath);
- opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+ opTimer.stop("Found master at " + (loc == null ? null : new String(loc, Constants.UTF8)) + " in %DURATION%");
if (loc == null) {
return Collections.emptyList();
}
- return Collections.singletonList(new String(loc));
+ return Collections.singletonList(new String(loc, Constants.UTF8));
}
@Override
@@ -179,13 +179,13 @@ public class ZooKeeperInstance implements Instance {
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zookeeper.");
byte[] loc = zooCache.get(zRootLocPath);
- opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+ opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc, Constants.UTF8)) + " in %DURATION%");
if (loc == null) {
return null;
}
- return new String(loc).split("\\|")[0];
+ return new String(loc, Constants.UTF8).split("\\|")[0];
}
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/cbf8a9fa/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
index ea833e0..156fa3a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
@@ -135,7 +135,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
List<String> copy = new ArrayList<String>(children);
Collections.sort(copy);
byte[] data = cache.get(path + "/" + candidate + "/" + copy.get(0));
- if (data != null && !"master".equals(new String(data))) {
+ if (data != null && !"master".equals(new String(data, Constants.UTF8))) {
results.add(candidate);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/cbf8a9fa/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
index fdb7014..3f5ac8c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
@@ -201,7 +201,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void create(String tableName, boolean limitVersion, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException {
ArgumentChecker.notNull(tableName, timeType);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(timeType.name().getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(timeType.name().getBytes(Constants.UTF8)));
Map<String,String> opts = IteratorUtil.generateInitialTableProperties(limitVersion);
@@ -500,7 +500,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
ArgumentChecker.notNull(tableName);
ByteBuffer EMPTY = ByteBuffer.allocate(0);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
: TextUtil.getByteBuffer(end));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -516,7 +516,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
ArgumentChecker.notNull(tableName);
ByteBuffer EMPTY = ByteBuffer.allocate(0);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
: TextUtil.getByteBuffer(end));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -643,7 +643,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void delete(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
ArgumentChecker.notNull(tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -675,7 +675,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
if (!Collections.disjoint(propertiesToExclude, propertiesToSet.keySet()))
throw new IllegalArgumentException("propertiesToSet and propertiesToExclude not disjoint");
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes()), ByteBuffer.wrap(newTableName.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes(Constants.UTF8)), ByteBuffer.wrap(newTableName.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
for (Entry<String,String> entry : propertiesToSet.entrySet()) {
if (entry.getKey().startsWith(CLONE_EXCLUDE_PREFIX))
@@ -710,7 +710,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void rename(String oldTableName, String newTableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException,
TableExistsException {
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes()), ByteBuffer.wrap(newTableName.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(newTableName.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
doTableOperation(TableOperation.RENAME, args, opts);
}
@@ -764,7 +764,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
if (flush)
_flush(tableId, start, end, true);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(Constants.UTF8)), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
: TextUtil.getByteBuffer(end), ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(iterators)));
Map<String,String> opts = new HashMap<String,String>();
@@ -780,7 +780,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void cancelCompaction(String tableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException {
String tableId = Tables.getTableId(instance, tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -1110,8 +1110,8 @@ public class TableOperationsImpl extends TableOperationsHelper {
throw new AccumuloException("Bulk import failure directory " + failPath + " is not empty");
}
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(dirPath.toString().getBytes()),
- ByteBuffer.wrap(failPath.toString().getBytes()), ByteBuffer.wrap((setTime + "").getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(dirPath.toString().getBytes(Constants.UTF8)),
+ ByteBuffer.wrap(failPath.toString().getBytes(Constants.UTF8)), ByteBuffer.wrap((setTime + "").getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -1138,7 +1138,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void offline(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
ArgumentChecker.notNull(tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -1162,7 +1162,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
@Override
public void online(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
ArgumentChecker.notNull(tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)));
Map<String,String> opts = new HashMap<String,String>();
try {
@@ -1214,7 +1214,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
ZipEntry zipEntry;
while ((zipEntry = zis.getNextEntry()) != null) {
if (zipEntry.getName().equals(Constants.EXPORT_TABLE_CONFIG_FILE)) {
- BufferedReader in = new BufferedReader(new InputStreamReader(zis));
+ BufferedReader in = new BufferedReader(new InputStreamReader(zis, Constants.UTF8));
String line;
while ((line = in.readLine()) != null) {
String sa[] = line.split("=", 2);
@@ -1250,7 +1250,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
Logger.getLogger(this.getClass()).warn("Failed to check if imported table references external java classes : " + ioe.getMessage());
}
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(importDir.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(importDir.getBytes(Constants.UTF8)));
Map<String,String> opts = Collections.emptyMap();
@@ -1267,7 +1267,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void exportTable(String tableName, String exportDir) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(tableName, exportDir);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(exportDir.getBytes()));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(exportDir.getBytes(Constants.UTF8)));
Map<String,String> opts = Collections.emptyMap();