Commits

Patrick Mézard  committed 770f5f8 Merge

Merge with r420

  • Participants
  • Parent commits 91c16ac, 83698c0

Comments (0)

Files changed (5)

File csharp/PhoneNumbers.Test/TestPhoneNumberUtil.cs

             phoneUtil.ParseAndKeepRawInput("2087654321", RegionCode.GB);
             Assert.AreEqual("20 8765 4321",
             phoneUtil.FormatInOriginalFormat(numberWithoutNationalPrefixGB, RegionCode.GB));
+            // Make sure no metadata is modified as a result of the previous function call.
+            Assert.AreEqual("(020) 8765 4321", phoneUtil.FormatInOriginalFormat(number5, RegionCode.GB));
 
             PhoneNumber numberWithNationalPrefixMX =
             phoneUtil.ParseAndKeepRawInput("013312345678", RegionCode.MX);

File csharp/PhoneNumbers/PhoneNumberUtil.cs

                         break;
                     }
                     // Otherwise, we need to remove the national prefix from our output.
-                    formatRule = new NumberFormat.Builder()
-                        .MergeFrom(formatRule).ClearNationalPrefixFormattingRule().Build();
+                    var numFormatCopy = new NumberFormat.Builder()
+                        .MergeFrom(formatRule)
+                        .ClearNationalPrefixFormattingRule()
+                        .Build();
                     List<NumberFormat> numberFormats = new List<NumberFormat>(1);
-                    numberFormats.Add(formatRule);
+                    numberFormats.Add(numFormatCopy);
                     formattedNumber = FormatByPattern(number, PhoneNumberFormat.NATIONAL, numberFormats);
                     break;
             }

File csharp/PhoneNumbers/Properties/AssemblyInfo.cs

 //
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("4.5.0.6")]
-[assembly: AssemblyVersion("4.5.0.6")]
-[assembly: AssemblyFileVersion("4.5.0.6")]
+// [assembly: AssemblyVersion("4.5.0.7")]
+[assembly: AssemblyVersion("4.5.0.7")]
+[assembly: AssemblyFileVersion("4.5.0.7")]

File java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java

           break;
         }
         // Otherwise, we need to remove the national prefix from our output.
-        formatRule.clearNationalPrefixFormattingRule();
+        NumberFormat numFormatCopy = new NumberFormat();
+        numFormatCopy.mergeFrom(formatRule);
+        numFormatCopy.clearNationalPrefixFormattingRule();
         List<NumberFormat> numberFormats = new ArrayList<NumberFormat>(1);
-        numberFormats.add(formatRule);
+        numberFormats.add(numFormatCopy);
         formattedNumber = formatByPattern(number, PhoneNumberFormat.NATIONAL, numberFormats);
         break;
     }

File java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java

         phoneUtil.parseAndKeepRawInput("2087654321", RegionCode.GB);
     assertEquals("20 8765 4321",
         phoneUtil.formatInOriginalFormat(numberWithoutNationalPrefixGB, RegionCode.GB));
+    // Make sure no metadata is modified as a result of the previous function call.
+    assertEquals("(020) 8765 4321", phoneUtil.formatInOriginalFormat(number5, RegionCode.GB));
 
     PhoneNumber numberWithNationalPrefixMX =
         phoneUtil.parseAndKeepRawInput("013312345678", RegionCode.MX);