X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=zxing.appspot.com%2Fgenerator%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fweb%2Fgenerator%2Fclient%2FContactInfoGenerator.java;h=af6d599d420ec989c1f4a985574890e5a3387985;hb=1d78494e0316d4dac531695ca288af6712008e36;hp=d3d9934e1dcdecb2f6936ddb03a1202694a48b57;hpb=c7f0418eeeb1cdcd4bc199a1c0dcd6d1b85e3c13;p=zxing.git diff --git a/zxing.appspot.com/generator/src/com/google/zxing/web/generator/client/ContactInfoGenerator.java b/zxing.appspot.com/generator/src/com/google/zxing/web/generator/client/ContactInfoGenerator.java index d3d9934e..af6d599d 100644 --- a/zxing.appspot.com/generator/src/com/google/zxing/web/generator/client/ContactInfoGenerator.java +++ b/zxing.appspot.com/generator/src/com/google/zxing/web/generator/client/ContactInfoGenerator.java @@ -116,26 +116,30 @@ public class ContactInfoGenerator implements GeneratorSource { } */ - private static String parseTextField(TextBox textBox) throws GeneratorException { + private static String parseTextField(String name, TextBox textBox) throws GeneratorException { String input = textBox.getText(); if (input.length() < 1) { return ""; } if (input.contains("\n")) { - throw new GeneratorException("Field must not contain \\n characters."); + throw new GeneratorException(name + " field must not contain \\n characters."); } if (input.contains(";")) { - throw new GeneratorException("Field must not contains ; characters"); + throw new GeneratorException(name + " field must not contains ; characters"); } return input; } private String getNameField() throws GeneratorException { - return parseTextField(name); + String input = name.getText(); + if (input.length() < 1) { + throw new GeneratorException("Name must be at least 1 character."); + } + return parseTextField("Name", name); } private String getCompanyField() throws GeneratorException { - return parseTextField(company); + return parseTextField("Company", company); } private String getTelField() throws GeneratorException { @@ -171,15 +175,15 @@ public class ContactInfoGenerator implements GeneratorSource { } private String getAddressField() throws GeneratorException { - return parseTextField(address); + return parseTextField("Address", address); } private String getAddress2Field() throws GeneratorException { - return parseTextField(address2); + return parseTextField("Address 2", address2); } private String getMemoField() throws GeneratorException { - return parseTextField(memo); + return parseTextField("Memo", memo); } public Grid getWidget() {