Issue 311 fix
[zxing.git] / core / src / com / google / zxing / oned / EAN8Reader.java
index d83c751..3e64ea6 100644 (file)
 
 package com.google.zxing.oned;
 
-import com.google.zxing.ReaderException;
 import com.google.zxing.BarcodeFormat;
+import com.google.zxing.ReaderException;
 import com.google.zxing.common.BitArray;
 
 /**
  * <p>Implements decoding of the EAN-8 format.</p>
  *
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
  */
-public final class EAN8Reader extends AbstractUPCEANReader {
+public final class EAN8Reader extends UPCEANReader {
 
-  protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result) throws ReaderException {
+  private final int[] decodeMiddleCounters;
+
+  public EAN8Reader() {
+    decodeMiddleCounters = new int[4];
+  }
 
-    int[] counters = new int[4];
+  protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
+      throws ReaderException {
+    int[] counters = decodeMiddleCounters;
+    counters[0] = 0;
+    counters[1] = 0;
+    counters[2] = 0;
+    counters[3] = 0;
     int end = row.getSize();
     int rowOffset = startRange[1];
 
@@ -56,7 +66,7 @@ public final class EAN8Reader extends AbstractUPCEANReader {
   }
 
   BarcodeFormat getBarcodeFormat() {
-    return BarcodeFormat.EAN_8;  
+    return BarcodeFormat.EAN_8;
   }
 
-}
\ No newline at end of file
+}