move to singleton ReaderException for a bit more performance
[zxing.git] / core / src / com / google / zxing / oned / UPCEReader.java
index c67103d..f8b885a 100644 (file)
@@ -26,7 +26,7 @@ import com.google.zxing.common.BitArray;
  * <p><a href="http://www.barcodeisland.com/upce.phtml">This</a> is a great reference for
  * UPC-E information.</p>
  *
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
  */
 public final class UPCEReader extends AbstractUPCEANReader {
 
@@ -46,7 +46,7 @@ public final class UPCEReader extends AbstractUPCEANReader {
       {0x07, 0x0B, 0x0D, 0x0E, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A}
   };
 
-  private int[] decodeMiddleCounters;
+  private final int[] decodeMiddleCounters;
 
   public UPCEReader() {
     decodeMiddleCounters = new int[4];
@@ -99,7 +99,7 @@ public final class UPCEReader extends AbstractUPCEANReader {
         }
       }
     }
-    throw new ReaderException("Unable to determine number system and check digit");
+    throw ReaderException.getInstance();
   }
 
   BarcodeFormat getBarcodeFormat() {
@@ -112,7 +112,7 @@ public final class UPCEReader extends AbstractUPCEANReader {
    * @param upce UPC-E code as string of digits
    * @return equivalent UPC-A code as string of digits
    */
-  private static String convertUPCEtoUPCA(String upce) {
+  public static String convertUPCEtoUPCA(String upce) {
     char[] upceChars = new char[6];
     upce.getChars(1, 7, upceChars, 0);
     StringBuffer result = new StringBuffer(12);