mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fix Contact qrcode generator on appengine.
git-svn-id: https://zxing.googlecode.com/svn/trunk@936 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
9ab5dc84ab
commit
436ee016d3
|
@ -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();
|
String input = textBox.getText();
|
||||||
if (input.length() < 1) {
|
if (input.length() < 1) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (input.contains("\n")) {
|
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(";")) {
|
if (input.contains(";")) {
|
||||||
throw new GeneratorException("Field must not contains ; characters");
|
throw new GeneratorException(name + " field must not contains ; characters");
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNameField() throws GeneratorException {
|
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 {
|
private String getCompanyField() throws GeneratorException {
|
||||||
return parseTextField(company);
|
return parseTextField("Company", company);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTelField() throws GeneratorException {
|
private String getTelField() throws GeneratorException {
|
||||||
|
@ -171,15 +175,15 @@ public class ContactInfoGenerator implements GeneratorSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAddressField() throws GeneratorException {
|
private String getAddressField() throws GeneratorException {
|
||||||
return parseTextField(address);
|
return parseTextField("Address", address);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAddress2Field() throws GeneratorException {
|
private String getAddress2Field() throws GeneratorException {
|
||||||
return parseTextField(address2);
|
return parseTextField("Address 2", address2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMemoField() throws GeneratorException {
|
private String getMemoField() throws GeneratorException {
|
||||||
return parseTextField(memo);
|
return parseTextField("Memo", memo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Grid getWidget() {
|
public Grid getWidget() {
|
||||||
|
|
Loading…
Reference in a new issue