abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Parsons (JIRA)" <j...@apache.org>
Subject [jira] Created: (ABDERA-275) Error in Turkish Locale when using GZIP compression
Date Wed, 15 Dec 2010 16:40:00 GMT
Error in Turkish Locale when using GZIP compression
---------------------------------------------------

                 Key: ABDERA-275
                 URL: https://issues.apache.org/jira/browse/ABDERA-275
             Project: Abdera
          Issue Type: Bug
    Affects Versions: 1.1.1, 1.1, 1.0, 0.4.0, 0.3.0, 0.2.2
         Environment: Issue was found on Windows XP, not tested on other OSes.  Issue affects
Turkish Locale.
            Reporter: Tim Parsons


>From a client machine, using the Turkish locale, try to retrieve a feed from a remote
server that uses GZIP compression.  An exception is thrown:

java.lang.IllegalArgumentException: No enum const class org.apache.abdera.i18n.text.io.CompressionUtil$CompressionCodec.GZ?P
	at java.lang.Enum.valueOf(Unknown Source)
	at org.apache.abdera.i18n.text.io.CompressionUtil$CompressionCodec.valueOf(CompressionUtil.java:30)
	at org.apache.abdera.i18n.text.io.CompressionUtil$CompressionCodec.value(CompressionUtil.java:36)
	at org.apache.abdera.i18n.text.io.CompressionUtil.getDecodingInputStream(CompressionUtil.java:94)
	at org.apache.abdera.protocol.client.CommonsResponse.getInputStream(CommonsResponse.java:150)
	at org.apache.abdera.protocol.client.cache.InMemoryCachedResponse.<init>(InMemoryCachedResponse.java:48)
	at org.apache.abdera.protocol.client.cache.InMemoryCache.createCachedResponse(InMemoryCache.java:38)
	at org.apache.abdera.protocol.client.cache.AbstractCache.update(AbstractCache.java:127)
	at org.apache.abdera.protocol.client.cache.AbstractCache.update(AbstractCache.java:105)
	at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:693)
	at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:216)
	at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:404)

The problem occurs because a string comparison using upper case is involved, and the locale
is not set to English.  

This issue was first found in Abdera 0.2.2.  A test application was written, and Abdera 0.4,
1.1 and 1.1.1 were all tested with it.  The exception occurs in all versions of Abdera.  Here
is the source for the simple test app:

Locale.setDefault( new Locale("tr", "", ""));
		
try {
	Abdera abdera = new Abdera();
	
	// This line for Abdera 0.2.2
	// Client client = new CommonsClient(abdera);
			
	// This line for Abdera 0.4.0+
	AbderaClient client = new AbderaClient(abdera);
			
	String url = "http://abdera.apache.org/releases.xml";
	ClientResponse response = client.get(url);
	if( response.getStatus() == 200 ) {
		System.out.println("Connected OK");
			
	} else {
		System.out.println("Error connecting to URL: " + url + 
				"\nStatus code: " + response.getStatus() + 
				"\nStatus text: " + response.getStatusText() );
	}
} catch( Exception e ) {
	e.printStackTrace();
}

In Abdera 0.2.2, the fix was to change the following line in protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
from:
switch(ContentEncoding.valueOf(encodings[n].toUpperCase().replaceAll("-", ""))) {

to:
switch(ContentEncoding.valueOf(encodings[n].toUpperCase(Locale.ENGLISH).replaceAll("-", "")))
{

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message