accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [07/26] git commit: Make Comparators Serializable too, UTF8, and entrySet instead of keySet
Date Sat, 01 Feb 2014 03:23:06 GMT
Make Comparators Serializable too, UTF8, and entrySet instead of keySet


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

Branch: refs/heads/2292-findbugs
Commit: 10bd1d3af5fa2d45fcfa2a03233a783ac8dd97ed
Parents: eedeeae
Author: Josh Elser <elserj@apache.org>
Authored: Thu Jan 30 23:00:39 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Jan 31 22:18:52 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/file/BloomFilterLayer.java |  5 +++--
 .../core/file/rfile/bcfile/CompareUtils.java        |  9 +++++++--
 .../core/file/rfile/bcfile/TFileDumper.java         |  3 ++-
 .../core/iterators/ColumnFamilyCounter.java         |  3 ++-
 .../accumulo/core/iterators/IteratorUtil.java       |  6 ++++--
 .../accumulo/core/iterators/LongCombiner.java       |  5 +++--
 .../accumulo/core/iterators/conf/ColumnSet.java     |  5 +++--
 .../core/iterators/user/BigDecimalCombiner.java     |  5 +++--
 .../accumulo/core/iterators/user/GrepIterator.java  |  3 ++-
 .../core/iterators/user/IntersectingIterator.java   | 11 ++++++-----
 .../core/iterators/user/LargeRowFilter.java         |  3 ++-
 .../accumulo/core/iterators/user/RegExFilter.java   |  3 ++-
 .../core/iterators/user/RowDeletingIterator.java    |  3 ++-
 .../core/iterators/user/SummingArrayCombiner.java   |  5 +++--
 .../core/iterators/user/TransformingIterator.java   | 16 +++++++++-------
 15 files changed, 53 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/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 e79da37..01485d3 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
@@ -36,6 +36,7 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.bloomfilter.DynamicBloomFilter;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.ConfigurationCopy;
@@ -433,8 +434,8 @@ public class BloomFilterLayer {
     
     for (Integer i : vals) {
       String fi = String.format("%010d", i);
-      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf1")),
new Value(("v" + fi).getBytes()));
-      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf2")),
new Value(("v" + fi).getBytes()));
+      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf1")),
new Value(("v" + fi).getBytes(Constants.UTF8)));
+      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf2")),
new Value(("v" + fi).getBytes(Constants.UTF8)));
     }
     
     long t2 = System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/CompareUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/CompareUtils.java
b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/CompareUtils.java
index 9dba4b1..0e2bb17 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/CompareUtils.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/CompareUtils.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.file.rfile.bcfile;
 
+import java.io.Serializable;
 import java.util.Comparator;
 
 import org.apache.hadoop.io.RawComparator;
@@ -68,7 +69,9 @@ class CompareUtils {
     }
   }
   
-  public static final class ScalarComparator implements Comparator<Scalar> {
+  public static final class ScalarComparator implements Comparator<Scalar>, Serializable
{
+    private static final long serialVersionUID = 1L;
+
     @Override
     public int compare(Scalar o1, Scalar o2) {
       long diff = o1.magnitude() - o2.magnitude();
@@ -80,7 +83,9 @@ class CompareUtils {
     }
   }
   
-  public static final class MemcmpRawComparator implements RawComparator<Object> {
+  public static final class MemcmpRawComparator implements RawComparator<Object>, Serializable
{
+    private static final long serialVersionUID = 1L;
+
     @Override
     public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
       return WritableComparator.compareBytes(b1, s1, l1, b2, s2, l2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFileDumper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFileDumper.java
b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFileDumper.java
index d5b0a1b..9b9cd51 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFileDumper.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/TFileDumper.java
@@ -24,6 +24,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.file.rfile.bcfile.BCFile.BlockRegion;
 import org.apache.accumulo.core.file.rfile.bcfile.BCFile.MetaIndexEntry;
 import org.apache.accumulo.core.file.rfile.bcfile.TFile.TFileIndexEntry;
@@ -208,7 +209,7 @@ class TFileDumper {
               out.printf("%X", b);
             }
           } else {
-            out.print(new String(key, 0, sampleLen));
+            out.print(new String(key, 0, sampleLen, Constants.UTF8));
           }
           if (sampleLen < key.length) {
             out.print("...");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/ColumnFamilyCounter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/ColumnFamilyCounter.java
b/core/src/main/java/org/apache/accumulo/core/iterators/ColumnFamilyCounter.java
index f780868..b187808 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/ColumnFamilyCounter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/ColumnFamilyCounter.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
@@ -58,7 +59,7 @@ public class ColumnFamilyCounter implements SortedKeyValueIterator<Key,Value>
{
       }
       
       this.key = new Key(currentRow.toArray(), currentColf.toArray(), new byte[0], new byte[0],
ts);
-      this.value = new Value(Integer.toString(count).getBytes());
+      this.value = new Value(Integer.toString(count).getBytes(Constants.UTF8));
       
     } else {
       this.key = null;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
index 049f854..1d58c2f 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.core.iterators;
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -54,8 +55,9 @@ public class IteratorUtil {
     majc, minc, scan;
   }
   
-  public static class IterInfoComparator implements Comparator<IterInfo> {
-    
+  public static class IterInfoComparator implements Comparator<IterInfo>, Serializable
{
+    private static final long serialVersionUID = 1L;
+
     @Override
     public int compare(IterInfo o1, IterInfo o2) {
       return (o1.priority < o2.priority ? -1 : (o1.priority == o2.priority ? 0 : 1));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
index da23699..a4efec9 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
@@ -23,6 +23,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
@@ -178,13 +179,13 @@ public abstract class LongCombiner extends TypedValueCombiner<Long>
{
   public static class StringEncoder implements Encoder<Long> {
     @Override
     public byte[] encode(Long v) {
-      return Long.toString(v).getBytes();
+      return Long.toString(v).getBytes(Constants.UTF8);
     }
     
     @Override
     public Long decode(byte[] b) {
       try {
-        return Long.parseLong(new String(b));
+        return Long.parseLong(new String(b, Constants.UTF8));
       } catch (NumberFormatException nfe) {
         throw new ValueFormatException(nfe);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
index 93c1d37..985216c 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
@@ -20,6 +20,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.iterators.conf.ColumnUtil.ColFamHashKey;
 import org.apache.accumulo.core.iterators.conf.ColumnUtil.ColHashKey;
@@ -135,7 +136,7 @@ public class ColumnSet {
   static Text decode(String s) {
     Text t = new Text();
     
-    byte[] sb = s.getBytes();
+    byte[] sb = s.getBytes(Constants.UTF8);
     
     // very inefficient code
     for (int i = 0; i < sb.length; i++) {
@@ -143,7 +144,7 @@ public class ColumnSet {
         t.append(new byte[] {sb[i]}, 0, 1);
       } else {
         byte hex[] = new byte[] {sb[++i], sb[++i]};
-        String hs = new String(hex);
+        String hs = new String(hex, Constants.UTF8);
         int b = Integer.parseInt(hs, 16);
         t.append(new byte[] {(byte) b}, 0, 1);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/BigDecimalCombiner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/BigDecimalCombiner.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/BigDecimalCombiner.java
index b037e17..dfea550 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/BigDecimalCombiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/BigDecimalCombiner.java
@@ -21,6 +21,7 @@ import java.math.BigDecimal;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.IteratorEnvironment;
@@ -102,13 +103,13 @@ public abstract class BigDecimalCombiner extends TypedValueCombiner<BigDecimal>
   public static class BigDecimalEncoder implements org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder<BigDecimal>
{
     @Override
     public byte[] encode(BigDecimal v) {
-      return v.toString().getBytes();
+      return v.toString().getBytes(Constants.UTF8);
     }
     
     @Override
     public BigDecimal decode(byte[] b) throws ValueFormatException {
       try {
-        return new BigDecimal(new String(b));
+        return new BigDecimal(new String(b, Constants.UTF8));
       } catch (NumberFormatException nfe) {
         throw new ValueFormatException(nfe);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/GrepIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/GrepIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/GrepIterator.java
index ab8ca84..4f8207c 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/GrepIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/GrepIterator.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -88,7 +89,7 @@ public class GrepIterator extends Filter {
   @Override
   public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String>
options, IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
-    term = options.get("term").getBytes();
+    term = options.get("term").getBytes(Constants.UTF8);
   }
   
   /**

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
index dbad38f..447200b 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -111,7 +112,7 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value>
{
     }
     
     public String getTermString() {
-      return (this.term == null) ? new String("Iterator") : this.term.toString();
+      return (this.term == null) ? "Iterator" : this.term.toString();
     }
   }
   
@@ -391,7 +392,7 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value>
{
   protected static String encodeColumns(Text[] columns) {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < columns.length; i++) {
-      sb.append(new String(Base64.encodeBase64(TextUtil.getBytes(columns[i]))));
+      sb.append(new String(Base64.encodeBase64(TextUtil.getBytes(columns[i])), Constants.UTF8));
       sb.append('\n');
     }
     return sb.toString();
@@ -409,14 +410,14 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value>
{
       else
         bytes[i] = 0;
     }
-    return new String(Base64.encodeBase64(bytes));
+    return new String(Base64.encodeBase64(bytes), Constants.UTF8);
   }
   
   protected static Text[] decodeColumns(String columns) {
     String[] columnStrings = columns.split("\n");
     Text[] columnTexts = new Text[columnStrings.length];
     for (int i = 0; i < columnStrings.length; i++) {
-      columnTexts[i] = new Text(Base64.decodeBase64(columnStrings[i].getBytes()));
+      columnTexts[i] = new Text(Base64.decodeBase64(columnStrings[i].getBytes(Constants.UTF8)));
     }
     return columnTexts;
   }
@@ -430,7 +431,7 @@ public class IntersectingIterator implements SortedKeyValueIterator<Key,Value>
{
     if (flags == null)
       return null;
     
-    byte[] bytes = Base64.decodeBase64(flags.getBytes());
+    byte[] bytes = Base64.decodeBase64(flags.getBytes(Constants.UTF8));
     boolean[] bFlags = new boolean[bytes.length];
     for (int i = 0; i < bytes.length; i++) {
       if (bytes[i] == 1)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
index d79604c..fdad848 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
@@ -23,6 +23,7 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -44,7 +45,7 @@ import org.apache.hadoop.io.Text;
  */
 public class LargeRowFilter implements SortedKeyValueIterator<Key,Value>, OptionDescriber
{
   
-  public static final Value SUPPRESS_ROW_VALUE = new Value("SUPPRESS_ROW".getBytes());
+  public static final Value SUPPRESS_ROW_VALUE = new Value("SUPPRESS_ROW".getBytes(Constants.UTF8));
   
   private static final ByteSequence EMPTY = new ArrayByteSequence(new byte[] {});
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java b/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
index b110d34..3f5669e 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -192,7 +193,7 @@ public class RegExFilter extends Filter {
         this.encoding = options.get(ENCODING);
         if ("".equals(this.encoding))
           encoding = ENCODING_DEFAULT;
-        new String("test".getBytes(), encoding);
+        new String("test".getBytes(Constants.UTF8), encoding);
       } catch (UnsupportedEncodingException e) {
         throw new IllegalArgumentException("invalid encoding " + ENCODING + ":" + this.encoding,
e);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowDeletingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowDeletingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowDeletingIterator.java
index b139096..45860eb 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/RowDeletingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/RowDeletingIterator.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -48,7 +49,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 
 public class RowDeletingIterator implements SortedKeyValueIterator<Key,Value> {
   
-  public static final Value DELETE_ROW_VALUE = new Value("DEL_ROW".getBytes());
+  public static final Value DELETE_ROW_VALUE = new Value("DEL_ROW".getBytes(Constants.UTF8));
   private SortedKeyValueIterator<Key,Value> source;
   private boolean propogateDeletes;
   private ByteSequence currentRow;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
index 0ab0cc0..77c829a 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
@@ -27,6 +27,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
@@ -207,12 +208,12 @@ public class SummingArrayCombiner extends TypedValueCombiner<List<Long>>
{
         sb.append(",");
         sb.append(Long.toString(la.get(i)));
       }
-      return sb.toString().getBytes();
+      return sb.toString().getBytes(Constants.UTF8);
     }
     
     @Override
     public List<Long> decode(byte[] b) {
-      String[] longstrs = new String(b).split(",");
+      String[] longstrs = new String(b, Constants.UTF8).split(",");
       List<Long> la = new ArrayList<Long>(longstrs.length);
       for (String s : longstrs) {
         if (s.length() == 0)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/10bd1d3a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
index f439437..8835b1c 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
@@ -24,8 +24,10 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.NoSuchElementException;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.ByteSequence;
@@ -110,7 +112,7 @@ abstract public class TransformingIterator extends WrappingIterator implements
O
     if (scanning) {
       String auths = options.get(AUTH_OPT);
       if (auths != null && !auths.isEmpty()) {
-        ve = new VisibilityEvaluator(new Authorizations(auths.getBytes()));
+        ve = new VisibilityEvaluator(new Authorizations(auths.getBytes(Constants.UTF8)));
         visibleCache = new LRUMap(100);
       }
     }
@@ -141,15 +143,15 @@ abstract public class TransformingIterator extends WrappingIterator
implements O
   @Override
   public boolean validateOptions(Map<String,String> options) {
     
-    for (String opt : options.keySet()) {
+    for (Entry<String,String> option : options.entrySet()) {
       try {
-        if (opt.equals(AUTH_OPT)) {
-          new Authorizations(options.get(opt).getBytes());
-        } else if (opt.equals(MAX_BUFFER_SIZE_OPT)) {
-          AccumuloConfiguration.getMemoryInBytes(options.get(opt));
+        if (option.getKey().equals(AUTH_OPT)) {
+          new Authorizations(option.getValue().getBytes(Constants.UTF8));
+        } else if (option.getKey().equals(MAX_BUFFER_SIZE_OPT)) {
+          AccumuloConfiguration.getMemoryInBytes(option.getValue());
         }
       } catch (Exception e) {
-        throw new IllegalArgumentException("Failed to parse opt " + opt + " " + options.get(opt),
e);
+        throw new IllegalArgumentException("Failed to parse opt " + option.getKey() + " "
+ option.getValue(), e);
       }
     }
     


Mime
View raw message