Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: components/policy/core/browser/browser_policy_connector.cc

Issue 386573002: Gracefully handle icu errors when checking for enterprise domains. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/browser/browser_policy_connector.cc
diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc
index 1bad6f404ef76d2032eb6571ab945256368ca2cf..ead92324b6ba51131fa46d8aaa7764d45b161251 100644
--- a/components/policy/core/browser/browser_policy_connector.cc
+++ b/components/policy/core/browser/browser_policy_connector.cc
@@ -44,7 +44,16 @@ bool MatchDomain(const base::string16& domain, const base::string16& pattern) {
UErrorCode status = U_ZERO_ERROR;
const icu::UnicodeString icu_pattern(pattern.data(), pattern.length());
icu::RegexMatcher matcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status);
- DCHECK(U_SUCCESS(status)) << "Invalid domain pattern: " << pattern;
+ if (!U_SUCCESS(status)) {
+ // http://crbug.com/365351 - if for some reason the matcher creation fails
+ // just return that the pattern doesn't match the domain. This is safe
+ // because the calling method (IsNonEnterpriseUser()) is just used to enable
+ // an optimization for non-enterprise users - better to skip the
+ // optimization than crash.
+ DLOG(ERROR) << "Possible invalid domain pattern: " << pattern
Joao da Silva 2014/07/10 10:23:41 WDYT of gathering some UMA samples for this? We co
+ << " - Error: " << status;
+ return false;
+ }
icu::UnicodeString icu_input(domain.data(), domain.length());
matcher.reset(icu_input);
status = U_ZERO_ERROR;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698