"Split" ReaderException into subclasses to enable more useful error reporting
[zxing.git] / core / src / com / google / zxing / datamatrix / decoder / BitMatrixParser.java
index 6536ebf..849f5be 100644 (file)
@@ -16,7 +16,7 @@
 \r
 package com.google.zxing.datamatrix.decoder;\r
 \r
-import com.google.zxing.ReaderException;\r
+import com.google.zxing.FormatException;\r
 import com.google.zxing.common.BitMatrix;\r
 \r
 /**\r
@@ -30,12 +30,12 @@ final class BitMatrixParser {
 \r
   /**\r
    * @param bitMatrix {@link BitMatrix} to parse\r
-   * @throws ReaderException if dimension is < 10 or > 144 or not 0 mod 2\r
+   * @throws FormatException if dimension is < 10 or > 144 or not 0 mod 2\r
    */\r
-  BitMatrixParser(BitMatrix bitMatrix) throws ReaderException {\r
+  BitMatrixParser(BitMatrix bitMatrix) throws FormatException {\r
     int dimension = bitMatrix.getDimension();\r
     if (dimension < 10 || dimension > 144 || (dimension & 0x01) != 0) {\r
-      throw ReaderException.getInstance();\r
+      throw FormatException.getFormatInstance();\r
     }\r
     \r
     version = readVersion(bitMatrix);\r
@@ -52,10 +52,10 @@ final class BitMatrixParser {
    * \r
    * @param bitMatrix Original {@link BitMatrix} including alignment patterns\r
    * @return {@link Version} encapsulating the Data Matrix Code's "version"\r
-   * @throws ReaderException if the dimensions of the mapping matrix are not valid\r
+   * @throws FormatException if the dimensions of the mapping matrix are not valid\r
    * Data Matrix dimensions.\r
    */\r
-  Version readVersion(BitMatrix bitMatrix) throws ReaderException {\r
+  Version readVersion(BitMatrix bitMatrix) throws FormatException {\r
 \r
     if (version != null) {\r
       return version;\r
@@ -74,9 +74,9 @@ final class BitMatrixParser {
    * Data Matrix Code.</p>\r
    *\r
    * @return bytes encoded within the Data Matrix Code\r
-   * @throws ReaderException if the exact number of bytes expected is not read\r
+   * @throws FormatException if the exact number of bytes expected is not read\r
    */\r
-  byte[] readCodewords() throws ReaderException {\r
+  byte[] readCodewords() throws FormatException {\r
 \r
     byte[] result = new byte[version.getTotalCodewords()];\r
     int resultOffset = 0;\r
@@ -141,7 +141,7 @@ final class BitMatrixParser {
     } while ((row < numRows) || (column < numColumns));\r
 \r
     if (resultOffset != version.getTotalCodewords()) {\r
-      throw ReaderException.getInstance();\r
+      throw FormatException.getFormatInstance();\r
     }\r
     return result;\r
   }\r