Browse Source

Staudacher pii logging (#1893)

pull/1904/head
Andy Staudacher 8 years ago
committed by Keghani Kouzoujian
parent
commit
bdd1b5b5aa
3 changed files with 5 additions and 20 deletions
  1. +2
    -15
      cpp/src/phonenumbers/phonenumberutil.cc
  2. +1
    -4
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  3. +2
    -1
      pending_code_changes.txt

+ 2
- 15
cpp/src/phonenumbers/phonenumberutil.cc View File

@ -1786,11 +1786,8 @@ void PhoneNumberUtil::GetRegionCodeForNumber(const PhoneNumber& number,
std::list<string> region_codes;
GetRegionCodesForCountryCallingCode(country_calling_code, &region_codes);
if (region_codes.size() == 0) {
string number_string;
GetNationalSignificantNumber(number, &number_string);
VLOG(1) << "Missing/invalid country calling code ("
<< country_calling_code
<< ") for number " << number_string;
<< country_calling_code << ")";
*region_code = RegionCode::GetUnknown();
return;
}
@ -2256,9 +2253,6 @@ void PhoneNumberUtil::ExtractPossibleNumber(const string& number,
return;
}
VLOG(3) << "After stripping starting and trailing characters, left with: "
<< *extracted_number;
// Now remove any extra numbers at the end.
reg_exps_->capture_up_to_second_number_start_pattern_->
PartialMatch(*extracted_number, extracted_number);
@ -2649,7 +2643,6 @@ void PhoneNumberUtil::Normalize(string* number) const {
// method ExtractPossibleNumber.
bool PhoneNumberUtil::IsViablePhoneNumber(const string& number) const {
if (number.length() < kMinLengthForNsn) {
VLOG(2) << "Number too short to be viable:" << number;
return false;
}
return reg_exps_->valid_phone_number_pattern_->FullMatch(number);
@ -2817,11 +2810,6 @@ bool PhoneNumberUtil::MaybeStripExtension(string* number, string* extension)
&possible_extension_three)) {
// Replace the extensions in the original string here.
reg_exps_->extn_pattern_->Replace(&number_copy, "");
VLOG(4) << "Found an extension. Possible extension one: "
<< possible_extension_one
<< ". Possible extension two: " << possible_extension_two
<< ". Possible extension three: " << possible_extension_three
<< ". Remaining number: " << number_copy;
// If we find a potential extension, and the number preceding this is a
// viable number, we assume it is an extension.
if ((!possible_extension_one.empty() || !possible_extension_two.empty() ||
@ -2932,8 +2920,7 @@ PhoneNumberUtil::ErrorType PhoneNumberUtil::MaybeExtractCountryCode(
MaybeStripNationalPrefixAndCarrierCode(*default_region_metadata,
&potential_national_number,
NULL);
VLOG(4) << "Number without country calling code prefix: "
<< potential_national_number;
VLOG(4) << "Number without country calling code prefix";
// If the number was not valid before but is valid now, or if it was too
// long before, we consider the number with the country code stripped to
// be a better result and keep that instead.


+ 1
- 4
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -656,7 +656,6 @@ public class PhoneNumberUtil {
Matcher trailingCharsMatcher = UNWANTED_END_CHAR_PATTERN.matcher(number);
if (trailingCharsMatcher.find()) {
number = number.subSequence(0, trailingCharsMatcher.start());
logger.log(Level.FINER, "Stripped trailing characters: " + number);
}
// Check for extra numbers at the end.
Matcher secondNumber = SECOND_NUMBER_START_PATTERN.matcher(number);
@ -2290,9 +2289,7 @@ public class PhoneNumberUtil {
int countryCode = number.getCountryCode();
List<String> regions = countryCallingCodeToRegionCodeMap.get(countryCode);
if (regions == null) {
String numberString = getNationalSignificantNumber(number);
logger.log(Level.INFO,
"Missing/invalid country_code (" + countryCode + ") for number " + numberString);
logger.log(Level.INFO, "Missing/invalid country_code (" + countryCode + ")");
return null;
}
if (regions.size() == 1) {


+ 2
- 1
pending_code_changes.txt View File

@ -1 +1,2 @@
Code changes:
- Logging changes: Don't log client-provided phone numbers.

Loading…
Cancel
Save