mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
A fixed fix for email parsing
git-svn-id: https://zxing.googlecode.com/svn/trunk@858 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
dd1eccfda8
commit
8e73582187
|
@ -47,7 +47,7 @@ final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implements only the most basic checking for an email address's validity -- that it contains
|
* This implements only the most basic checking for an email address's validity -- that it contains
|
||||||
* an '@' and a '.' somewhere after that, and that it contains no space.
|
* an '@' and a '.', and that it contains no space or LF.
|
||||||
* We want to generally be lenient here since this class is only intended to encapsulate what's
|
* We want to generally be lenient here since this class is only intended to encapsulate what's
|
||||||
* in a barcode, not "judge" it.
|
* in a barcode, not "judge" it.
|
||||||
*/
|
*/
|
||||||
|
@ -56,19 +56,18 @@ final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean atFound = false;
|
boolean atFound = false;
|
||||||
|
boolean periodFound = false;
|
||||||
for (int i = 0; i < email.length(); i++) {
|
for (int i = 0; i < email.length(); i++) {
|
||||||
char c = email.charAt(i);
|
char c = email.charAt(i);
|
||||||
if (c == '@') {
|
if (c == '@') {
|
||||||
atFound = true;
|
atFound = true;
|
||||||
} else if (c == '.') {
|
} else if (c == '.') {
|
||||||
if (!atFound) {
|
periodFound = true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (c == ' ' || c == '\n') {
|
} else if (c == ' ' || c == '\n') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return atFound && periodFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -45,8 +45,6 @@ public abstract class ResultParser {
|
||||||
return result;
|
return result;
|
||||||
} else if ((result = EmailDoCoMoResultParser.parse(theResult)) != null) {
|
} else if ((result = EmailDoCoMoResultParser.parse(theResult)) != null) {
|
||||||
return result;
|
return result;
|
||||||
} else if ((result = EmailAddressResultParser.parse(theResult)) != null) {
|
|
||||||
return result;
|
|
||||||
} else if ((result = AddressBookAUResultParser.parse(theResult)) != null) {
|
} else if ((result = AddressBookAUResultParser.parse(theResult)) != null) {
|
||||||
return result;
|
return result;
|
||||||
} else if ((result = VCardResultParser.parse(theResult)) != null) {
|
} else if ((result = VCardResultParser.parse(theResult)) != null) {
|
||||||
|
@ -55,6 +53,8 @@ public abstract class ResultParser {
|
||||||
return result;
|
return result;
|
||||||
} else if ((result = VEventResultParser.parse(theResult)) != null) {
|
} else if ((result = VEventResultParser.parse(theResult)) != null) {
|
||||||
return result;
|
return result;
|
||||||
|
} else if ((result = EmailAddressResultParser.parse(theResult)) != null) {
|
||||||
|
return result;
|
||||||
} else if ((result = TelResultParser.parse(theResult)) != null) {
|
} else if ((result = TelResultParser.parse(theResult)) != null) {
|
||||||
return result;
|
return result;
|
||||||
} else if ((result = SMSMMSResultParser.parse(theResult)) != null) {
|
} else if ((result = SMSMMSResultParser.parse(theResult)) != null) {
|
||||||
|
|
Loading…
Reference in a new issue