Browse Source

JAVA,GEODATA: Fix broken test after US data split commit.

pull/567/head
Philippe Liard 15 years ago
committed by Mihaela Rosca
parent
commit
0a4585a175
8 changed files with 6 additions and 14 deletions
  1. +6
    -14
      java/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java
  2. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1201_en
  3. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1212_en
  4. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1617_en
  5. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1650_en
  6. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1989_en
  7. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1_en
  8. BIN
      java/test/com/google/i18n/phonenumbers/geocoding/testing_data/config

+ 6
- 14
java/src/com/google/i18n/phonenumbers/geocoding/PhoneNumberOfflineGeocoder.java View File

@ -110,19 +110,6 @@ public class PhoneNumberOfflineGeocoder {
return instance;
}
/**
* Preload the data file for the given language and country calling code, so that a future lookup
* for this language and country calling code will not incur any file loading.
*
* @param locale specifies the language of the data file to load
* @param countryCallingCode specifies the country calling code of phone numbers that are
* contained by the file to be loaded
*/
public void loadDataFile(Locale locale, int countryCallingCode) {
instance.getPhonePrefixDescriptions(countryCallingCode, locale.getLanguage(), "",
locale.getCountry());
}
/**
* Returns the customary display name in the given language for the given territory the phone
* number is from.
@ -185,8 +172,13 @@ public class PhoneNumberOfflineGeocoder {
*/
private String getAreaDescriptionForNumber(
PhoneNumber number, String lang, String script, String region) {
int countryCallingCode = number.getCountryCode();
// As the NANPA data is split into multiple files covering 3-digit areas, use a phone number
// prefix of 4 digits for NANPA instead, e.g. 1650.
int phonePrefix = (countryCallingCode != 1) ?
countryCallingCode : (1000 + (int) (number.getNationalNumber() / 10000000));
AreaCodeMap phonePrefixDescriptions =
getPhonePrefixDescriptions(number.getCountryCode(), lang, script, region);
getPhonePrefixDescriptions(phonePrefix, lang, script, region);
return (phonePrefixDescriptions != null) ? phonePrefixDescriptions.lookup(number) : "";
}
}

BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1201_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1212_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1617_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1650_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1989_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/1_en View File


BIN
java/test/com/google/i18n/phonenumbers/geocoding/testing_data/config View File


Loading…
Cancel
Save