mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Detect invalid input to Code 39 encoder and reject it more explicitly
git-svn-id: https://zxing.googlecode.com/svn/trunk@2803 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
619ff4b882
commit
6fe6504dad
|
@ -54,6 +54,9 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
|
|||
int codeWidth = 24 + 1 + length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i));
|
||||
if (indexInString < 0) {
|
||||
throw new IllegalArgumentException("Bad contents: " + contents);
|
||||
}
|
||||
toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths);
|
||||
for (int width : widths) {
|
||||
codeWidth += width;
|
||||
|
|
Loading…
Reference in a new issue