abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r1050475 - in /abdera/java/trunk/dependencies/i18n/src: main/java/org/apache/abdera/i18n/text/io/ test/java/org/apache/abdera/i18n/text/ test/java/org/apache/abdera/i18n/text/io/
Date Fri, 17 Dec 2010 19:43:16 GMT
Author: ckoppelt
Date: Fri Dec 17 19:43:15 2010
New Revision: 1050475

URL: http://svn.apache.org/viewvc?rev=1050475&view=rev
Log:
fix for ABDERA-275

Added:
    abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/
    abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/
    abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/CompressionUtilTest.java
Modified:
    abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/io/CompressionUtil.java

Modified: abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/io/CompressionUtil.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/io/CompressionUtil.java?rev=1050475&r1=1050474&r2=1050475&view=diff
==============================================================================
--- abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/io/CompressionUtil.java
(original)
+++ abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/io/CompressionUtil.java
Fri Dec 17 19:43:15 2010
@@ -20,6 +20,7 @@ package org.apache.abdera.i18n.text.io;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Locale;
 import java.util.zip.DeflaterOutputStream;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
@@ -33,7 +34,7 @@ public class CompressionUtil {
         public static CompressionCodec value(String encoding) {
             if (encoding == null)
                 throw new IllegalArgumentException();
-            return valueOf(encoding.toUpperCase().replaceAll("-", ""));
+            return valueOf(encoding.toUpperCase(Locale.ENGLISH).replaceAll("-", ""));
         }
 
     }
@@ -43,7 +44,7 @@ public class CompressionUtil {
         if (name == null)
             return null;
         try {
-            codec = CompressionCodec.valueOf(name.toUpperCase().trim());
+            codec = CompressionCodec.valueOf(name.toUpperCase(Locale.ENGLISH).trim());
         } catch (Exception e) {
         }
         return codec;

Added: abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/CompressionUtilTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/CompressionUtilTest.java?rev=1050475&view=auto
==============================================================================
--- abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/CompressionUtilTest.java
(added)
+++ abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/text/io/CompressionUtilTest.java
Fri Dec 17 19:43:15 2010
@@ -0,0 +1,24 @@
+package org.apache.abdera.i18n.text.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Locale;
+
+import org.apache.abdera.i18n.text.io.CompressionUtil.CompressionCodec;
+import org.junit.Test;
+
+public class CompressionUtilTest {
+    
+    @Test
+    public void getCodecWithTurkishLocale (){
+        Locale.setDefault(new Locale("tr", "", ""));
+        CompressionCodec codec = CompressionUtil.getCodec("gzip");
+        assertEquals("GZIP", codec.toString());
+    }
+    
+    @Test
+    public void compressionCodecWithTurkishLocale (){
+        CompressionCodec codec = CompressionCodec.value("gzip");
+        assertEquals("GZIP", codec.toString());
+    }
+}



Mime
View raw message