projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
"Split" ReaderException into subclasses to enable more useful error reporting
[zxing.git]
/
core
/
src
/
com
/
google
/
zxing
/
oned
/
UPCEReader.java
diff --git
a/core/src/com/google/zxing/oned/UPCEReader.java
b/core/src/com/google/zxing/oned/UPCEReader.java
index
9acb0bd
..
ef74b97
100644
(file)
--- a/
core/src/com/google/zxing/oned/UPCEReader.java
+++ b/
core/src/com/google/zxing/oned/UPCEReader.java
@@
-16,8
+16,10
@@
package com.google.zxing.oned;
package com.google.zxing.oned;
-import com.google.zxing.ReaderException;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BarcodeFormat;
+import com.google.zxing.ChecksumException;
+import com.google.zxing.FormatException;
+import com.google.zxing.NotFoundException;
import com.google.zxing.common.BitArray;
/**
import com.google.zxing.common.BitArray;
/**
@@
-26,9
+28,9
@@
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>
*
* <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
Abstract
UPCEANReader {
+public final class UPCEReader extends UPCEANReader {
/**
* The pattern that marks the middle, and end, of a UPC-E pattern.
/**
* The pattern that marks the middle, and end, of a UPC-E pattern.
@@
-52,7
+54,8
@@
public final class UPCEReader extends AbstractUPCEANReader {
decodeMiddleCounters = new int[4];
}
decodeMiddleCounters = new int[4];
}
- protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result) throws ReaderException {
+ protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
+ throws NotFoundException {
int[] counters = decodeMiddleCounters;
counters[0] = 0;
counters[1] = 0;
int[] counters = decodeMiddleCounters;
counters[0] = 0;
counters[1] = 0;
@@
-79,16
+82,16
@@
public final class UPCEReader extends AbstractUPCEANReader {
return rowOffset;
}
return rowOffset;
}
- protected int[] decodeEnd(BitArray row, int endStart) throws
Reader
Exception {
+ protected int[] decodeEnd(BitArray row, int endStart) throws
NotFound
Exception {
return findGuardPattern(row, endStart, true, MIDDLE_END_PATTERN);
}
return findGuardPattern(row, endStart, true, MIDDLE_END_PATTERN);
}
- protected boolean checkChecksum(String s) throws
Reader
Exception {
+ protected boolean checkChecksum(String s) throws
FormatException, Checksum
Exception {
return super.checkChecksum(convertUPCEtoUPCA(s));
}
private static void determineNumSysAndCheckDigit(StringBuffer resultString, int lgPatternFound)
return super.checkChecksum(convertUPCEtoUPCA(s));
}
private static void determineNumSysAndCheckDigit(StringBuffer resultString, int lgPatternFound)
- throws
Reader
Exception {
+ throws
NotFound
Exception {
for (int numSys = 0; numSys <= 1; numSys++) {
for (int d = 0; d < 10; d++) {
for (int numSys = 0; numSys <= 1; numSys++) {
for (int d = 0; d < 10; d++) {
@@
-99,11
+102,11
@@
public final class UPCEReader extends AbstractUPCEANReader {
}
}
}
}
}
}
- throw
new ReaderException("Unable to determine number system and check digit"
);
+ throw
NotFoundException.getNotFoundInstance(
);
}
BarcodeFormat getBarcodeFormat() {
}
BarcodeFormat getBarcodeFormat() {
- return BarcodeFormat.UPC_E;
+ return BarcodeFormat.UPC_E;
}
/**
}
/**
@@
-147,4
+150,4
@@
public final class UPCEReader extends AbstractUPCEANReader {
return result.toString();
}
return result.toString();
}
-}
\ No newline at end of file
+}