Issue 1124 only allow encoding of even-length ITF input

git-svn-id: https://zxing.googlecode.com/svn/trunk@2118 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-01-15 18:21:18 +00:00
parent 2cbc5e4175
commit a39e9d8163

View file

@ -46,6 +46,9 @@ public final class ITFWriter extends UPCEANWriter {
@Override
public byte[] encode(String contents) {
int length = contents.length();
if (length % 2 != 0) {
throw new IllegalArgumentException("The lenght of the input should be even");
}
if (length > 80) {
throw new IllegalArgumentException(
"Requested contents should be less than 80 digits long, but got " + length);