Abdera fails to load META-INF/services provider configuration files on 
non-ASCII platforms
------------------------------------------------------------------------------------------

                 Key: ABDERA-250
                 URL: https://issues.apache.org/jira/browse/ABDERA-250
             Project: Abdera
          Issue Type: Bug
    Affects Versions: 0.4.0, 1.0
         Environment: z/OS, IBM Java 6.0 sr4
            Reporter: Robin Fernandes


Sun's jar file specification states that service provider config files (the 
files under META-INF/services that determine which implementations of a given 
interface to use) must be encoded as UTF-8: 
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Provider%20Configuration%20File

Abdera attempts to read these files without explicitly specifying an encoding. 
In other words, it assumes the files are in the default platform encoding. 
Consequently, on non-ASCII platforms, the files are not read correctly. For 
example, on z/OS (an EBCDIC platform), the UTF-8 config files are read as 
though they were EBCDIC by Abdera, so they are not processed correctly.

Here's a suggested patch:
Index: core/src/main/java/org/apache/abdera/util/ServiceUtil.java
===================================================================
--- core/src/main/java/org/apache/abdera/util/ServiceUtil.java  (revision 
834079)
+++ core/src/main/java/org/apache/abdera/util/ServiceUtil.java  (working copy)
@@ -279,7 +279,7 @@
     try {
       InputStream is = locateStream(sid);
       if (is != null) {
-        buf = new BufferedReader(new InputStreamReader(is));
+        buf = new BufferedReader(new InputStreamReader(is, "UTF-8"));
         String line = buf.readLine();
         if (line != null) {
           String s = line.split("#",2)[0].trim();
@@ -326,7 +326,7 @@
           URL url = (URL) e.nextElement();
           InputStream is = url.openStream();
           if (is != null) {
-            buf = new BufferedReader(new InputStreamReader(is));
+            buf = new BufferedReader(new InputStreamReader(is, "UTF-8"));
             String line;
             while ((line = buf.readLine()) != null) {
               String s = line.split("#",2)[0].trim();



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

Reply via email to