diff --git a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml index 1958cea2c..2aef4c279 100644 --- a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml +++ b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml @@ -4759,12 +4759,10 @@ - - $1 $2 $3 $4 - $1 $2 $3 - + $1 $2 $3 $4 + $1 $2 $3 [029]\d{7} diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 080a65a3f..2989a82b8 100644 --- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -571,7 +571,7 @@ public class PhoneNumberUtil { // they won't have an area code, which means clients don't need to worry about appending the // leading zero to the geographical area code they derive from the length we return here. return numberGroups[2].length(); - } + } /** * Normalizes a string of characters representing a phone number by replacing all characters found @@ -808,7 +808,7 @@ public Set getSupportedCountries() { } else if (countryCode == getCountryCodeForRegion(countryCallingFrom)) { // For countries that share a country calling code, the country code need not be dialled. This // also applies when dialling within a country, so this if clause covers both these cases. - // Technically this is the case for dialling from la RŽunion to other overseas departments of + // Technically this is the case for dialling from la Reunion to other overseas departments of // France (French Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover this // edge case for now and for those cases return the version including country code. // Details here: http://www.petitfute.com/voyage/225-info-pratiques-reunion @@ -866,11 +866,11 @@ public Set getSupportedCountries() { return format(number, PhoneNumberFormat.INTERNATIONAL).substring(1); case FROM_DEFAULT_COUNTRY: default: - return format(number, PhoneNumberFormat.NATIONAL); + return format(number, PhoneNumberFormat.NATIONAL); } } - + /** * Gets the national significant number of the a phone number. Note a national significant number * doesn't contain a national prefix or any formatting. @@ -918,7 +918,7 @@ public Set getSupportedCountries() { String regionCode, PhoneNumberFormat numberFormat) { return formatNationalNumber(number, regionCode, numberFormat, null); - } + } // Note in some countries, the national number can be written in two completely different ways // depending on whether it forms part of the NATIONAL format or INTERNATIONAL format. The diff --git a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java index 2e35d2259..09022bb23 100644 --- a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java +++ b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java @@ -481,7 +481,7 @@ public final class Phonemetadata { hasLeadingDigits = true; leadingDigits_ = value; return this; - } + } public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeBoolean(hasGeneralDesc); diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java index cd98a8cec..6ba5707ac 100644 --- a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java +++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java @@ -59,14 +59,16 @@ public class PhoneNumberUtilTest extends TestCase { super.tearDown(); } - private boolean assertEquals(PhoneNumber number1, PhoneNumber number2) { + private void assertEquals(PhoneNumber number1, PhoneNumber number2) { + boolean equal = false; if (number1 == null && number2 == null) { - return true; + equal = true; + } else if (number1 != null && number2 != null) { + equal = number1.exactlySameAs(number2); } - if (number1 == null || number2 == null) { - return false; + if (!equal) { + fail("The phone numbers do not match"); } - return number1.exactlySameAs(number2); } public void testGetInstanceLoadUSMetadata() throws IOException { @@ -496,7 +498,7 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("424 123 1234", phoneUtil.format(usNumber, PhoneNumberUtil.PhoneNumberFormat.NATIONAL)); assertEquals("424 123 1234", phoneUtil.formatNationalNumberWithCarrierCode(usNumber, "15")); - } + } public void testFormatByPattern() { PhoneNumber usNumber = new PhoneNumber(); @@ -783,7 +785,7 @@ public class PhoneNumberUtilTest extends TestCase { // This number is no longer valid. assertFalse(phoneUtil.isValidNumber(bsNumber)); - // La Mayotte and RŽunion use 'leadingDigits' to differentiate them. + // La Mayotte and Reunion use 'leadingDigits' to differentiate them. PhoneNumber reNumber = new PhoneNumber(); reNumber.setCountryCode(262).setNationalNumber(262123456L); assertTrue(phoneUtil.isValidNumber(reNumber)); @@ -793,7 +795,7 @@ public class PhoneNumberUtilTest extends TestCase { reNumber.setNationalNumber(269601234L); assertTrue(phoneUtil.isValidNumberForRegion(reNumber, "YT")); assertFalse(phoneUtil.isValidNumberForRegion(reNumber, "RE")); - // This number is no longer valid for La RŽunion. + // This number is no longer valid for La Reunion. reNumber.setNationalNumber(269123456L); assertFalse(phoneUtil.isValidNumberForRegion(reNumber, "YT")); assertFalse(phoneUtil.isValidNumberForRegion(reNumber, "RE")); @@ -1475,7 +1477,7 @@ public class PhoneNumberUtilTest extends TestCase { // Null is also allowed for the region code in these cases. assertEquals(nzNumber, phoneUtil.parseAndKeepRawInput("+64 3 331 6005", null)); } - + public void testParseExtensions() throws Exception { PhoneNumber nzNumber = new PhoneNumber(); nzNumber.setCountryCode(64).setNationalNumber(33316005L).setExtension("3456"); diff --git a/java/test/com/google/i18n/phonenumbers/RegexCacheTest.java b/java/test/com/google/i18n/phonenumbers/RegexCacheTest.java index 310a601c6..2ad0abea6 100644 --- a/java/test/com/google/i18n/phonenumbers/RegexCacheTest.java +++ b/java/test/com/google/i18n/phonenumbers/RegexCacheTest.java @@ -18,8 +18,6 @@ package com.google.i18n.phonenumbers; import junit.framework.TestCase; -import java.util.regex.Pattern; - /** * Unittests for LRU Cache for compiled regular expressions used by the libphonenumbers libary. *