Uploaded image for project: 'Abdera'
  1. Abdera
  2. ABDERA-250

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.4.0, 1.0
    • Fix Version/s: 1.1
    • Labels:
      None
    • Environment:
      z/OS, IBM Java 6.0 sr4

      Description

      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();

        Attachments

          Activity

            People

            • Assignee:
              ckoppelt Christine Koppelt
              Reporter:
              rewbs Robin Fernandes
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: