avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blachn...@apache.org
Subject [avro] branch branch-1.9 updated: AVRO-2500: Fix serializing int type in some cultures for C# bindings (#602)
Date Thu, 08 Aug 2019 00:40:32 GMT
This is an automated email from the ASF dual-hosted git repository.

blachniet pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 282226a  AVRO-2500: Fix serializing int type in some cultures for C# bindings (#602)
282226a is described below

commit 282226ae17054f8d83bd9d6edfc627e95db763db
Author: Anton Ryzhov <anton.ryzhov@gmail.com>
AuthorDate: Thu Aug 8 03:37:26 2019 +0300

    AVRO-2500: Fix serializing int type in some cultures for C# bindings (#602)
    
    * AVRO-2500: Fixing serializing int type in some cultures
    * AVRO-2500: Add unit test for schema name in Turkish culture
    
    (cherry picked commit from 4593c3651516a6ff5c30e43198285d6435e2ff49)
---
 lang/csharp/src/apache/main/Schema/UnnamedSchema.cs | 3 ++-
 lang/csharp/src/apache/test/Schema/SchemaTests.cs   | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lang/csharp/src/apache/main/Schema/UnnamedSchema.cs b/lang/csharp/src/apache/main/Schema/UnnamedSchema.cs
index 96f2b0d..90b28aa 100644
--- a/lang/csharp/src/apache/main/Schema/UnnamedSchema.cs
+++ b/lang/csharp/src/apache/main/Schema/UnnamedSchema.cs
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+using System.Globalization;
 
 namespace Avro
 {
@@ -35,7 +36,7 @@ namespace Avro
         /// <inheritdoc/>
         public override string Name
         {
-            get { return Tag.ToString().ToLower(); }
+            get { return Tag.ToString().ToLower(CultureInfo.InvariantCulture); }
         }
     }
 }
diff --git a/lang/csharp/src/apache/test/Schema/SchemaTests.cs b/lang/csharp/src/apache/test/Schema/SchemaTests.cs
index ea928b6..ba07f5a 100644
--- a/lang/csharp/src/apache/test/Schema/SchemaTests.cs
+++ b/lang/csharp/src/apache/test/Schema/SchemaTests.cs
@@ -317,5 +317,13 @@ namespace Avro.Test
             return name.Fullname;
         }
 
+        [TestCase("{ \"type\": \"int\" }", "int")]
+        [SetCulture("tr-TR")]
+        public void TestSchemaNameInTurkishCulture(string schemaJson, string expectedName)
+        {
+            var schema = Schema.Parse(schemaJson);
+
+            Assert.AreEqual(expectedName, schema.Name);
+        }
     }
 }


Mime
View raw message