Remove use of Hashtable.clone(), doesn't work in J2ME

git-svn-id: https://zxing.googlecode.com/svn/trunk@1139 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-12-08 12:02:35 +00:00
parent bdc25cf5bc
commit edddb45040

View file

@ -25,6 +25,7 @@ import com.google.zxing.ResultMetadataType;
import com.google.zxing.ResultPoint; import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitArray; import com.google.zxing.common.BitArray;
import java.util.Enumeration;
import java.util.Hashtable; 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 // don't want to clutter with noise from every single row scan -- just the scans
// that start on the center line. // that start on the center line.
if (hints != null && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) { if (hints != null && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
hints = (Hashtable) hints.clone(); Hashtable newHints = new Hashtable(); // Can't use clone() in J2ME
hints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK); 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 { try {