"Split" ReaderException into subclasses to enable more useful error reporting
[zxing.git] / core / src / com / google / zxing / multi / qrcode / QRCodeMultiReader.java
index a971547..72a7d68 100644 (file)
@@ -18,6 +18,7 @@ package com.google.zxing.multi.qrcode;
 
 import com.google.zxing.BarcodeFormat;
 import com.google.zxing.BinaryBitmap;
+import com.google.zxing.NotFoundException;
 import com.google.zxing.ReaderException;
 import com.google.zxing.Result;
 import com.google.zxing.ResultMetadataType;
@@ -41,13 +42,13 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
 
   private static final Result[] EMPTY_RESULT_ARRAY = new Result[0];
 
-  public Result[] decodeMultiple(BinaryBitmap image) throws ReaderException {
+  public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
     return decodeMultiple(image, null);
   }
 
-  public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws ReaderException {
+  public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws NotFoundException {
     Vector results = new Vector();
-    DetectorResult[] detectorResult = new MultiDetector(image).detectMulti(hints);
+    DetectorResult[] detectorResult = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
     for (int i = 0; i < detectorResult.length; i++) {
       try {
         DecoderResult decoderResult = getDecoder().decode(detectorResult[i].getBits());
@@ -57,6 +58,9 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
         if (decoderResult.getByteSegments() != null) {
           result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
         }
+        if (decoderResult.getECLevel() != null) {
+          result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString());
+        }
         results.addElement(result);
       } catch (ReaderException re) {
         // ignore and continue