mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
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:
parent
2cbc5e4175
commit
a39e9d8163
|
@ -46,6 +46,9 @@ public final class ITFWriter extends UPCEANWriter {
|
||||||
@Override
|
@Override
|
||||||
public byte[] encode(String contents) {
|
public byte[] encode(String contents) {
|
||||||
int length = contents.length();
|
int length = contents.length();
|
||||||
|
if (length % 2 != 0) {
|
||||||
|
throw new IllegalArgumentException("The lenght of the input should be even");
|
||||||
|
}
|
||||||
if (length > 80) {
|
if (length > 80) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Requested contents should be less than 80 digits long, but got " + length);
|
"Requested contents should be less than 80 digits long, but got " + length);
|
||||||
|
|
Loading…
Reference in a new issue