Remove use of Hashtable.clone(), doesn't work in J2ME
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 8 Dec 2009 12:02:35 +0000 (12:02 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 8 Dec 2009 12:02:35 +0000 (12:02 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1139 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/src/com/google/zxing/oned/OneDReader.java

index fba71fd..b3d4f5e 100644 (file)
@@ -25,6 +25,7 @@ import com.google.zxing.ResultMetadataType;
 import com.google.zxing.ResultPoint;
 import com.google.zxing.common.BitArray;
 
+import java.util.Enumeration;
 import java.util.Hashtable;
 
 /**
@@ -125,8 +126,15 @@ public abstract class OneDReader implements Reader {
           // don't want to clutter with noise from every single row scan -- just the scans
           // that start on the center line.
           if (hints != null && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
-            hints = (Hashtable) hints.clone();
-            hints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+            Hashtable newHints = new Hashtable(); // Can't use clone() in J2ME
+            Enumeration hintEnum = hints.keys();
+            while (hintEnum.hasMoreElements()) {
+              Object key = hintEnum.nextElement();
+              if (!key.equals(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
+                newHints.put(key, hints.get(key));
+              }
+            }
+            hints = newHints;
           }
         }
         try {