Wink
  1. Wink
  2. WINK-327

wink-provider files cannot be read when system default encoding is non-ASCII compliant (e.g. EBCDIC, IBM-1047)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.2
    • Fix Version/s: None
    • Component/s: Common
    • Labels:
      None
    • Environment:

      IBM Java for z/OS 6.0 running on z/OS 1.12 with default encoding IBM-1047.

      Description

      When executing in the described platform I am getting ClassNotFoundException:

      java.lang.ClassNotFoundException: <non-ascii characters>
      	at java.lang.Class.forNameImpl(Native Method)
      	at java.lang.Class.forName(Class.java:136)
      	at org.apache.wink.common.internal.utils.ClassUtils$1.run(ClassUtils.java:87)
      	at java.security.AccessController.doPrivileged(AccessController.java:202)
      	at org.apache.wink.common.internal.utils.ClassUtils.loadClass(ClassUtils.java:66)
      	at org.apache.wink.common.internal.application.ApplicationFileLoader.loadClasses(ApplicationFileLoader.java:126)
      	at org.apache.wink.common.internal.application.ApplicationFileLoader.<init>(ApplicationFileLoader.java:92)
      	at org.apache.wink.common.internal.application.ApplicationFileLoader.<init>(ApplicationFileLoader.java:66)
      	at org.apache.wink.server.internal.application.ServletApplicationFileLoader.<init>(ServletApplicationFileLoader.java:34)
      	at org.apache.wink.server.internal.RequestProcessor.registerDefaultApplication(RequestProcessor.java:82)
      	at org.apache.wink.server.internal.RequestProcessor.<init>(RequestProcessor.java:70)
      	at org.apache.wink.server.internal.servlet.RestServlet.createRequestProcessor(RestServlet.java:117)
      	at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:90)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:241)
      	<problem-irrelevant-stack>
      	...
      

      The <non-ascii characters> tag represents incorrectly decoded characters. It seems that the problem is this piece of code in class org.apache.wink.common.internal.application.ApplicationFileLoader:

      final protected void loadClasses(InputStream is) {
              try {
                  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
                  String line;
                  l: while ((line = bufferedReader.readLine()) != null) {
      		...
      

      Which is being called by:

      public ApplicationFileLoader(String appConfigFile) throws FileNotFoundException {
              logger.debug(Messages.getMessage("loadingApplication", appConfigFile)); //$NON-NLS-1$
              loadClasses(FileLoader.loadFileAsStream(appConfigFile));
          }
      

      to load the META-INF/corewink-provider file, and also by:

      public ServletApplicationFileLoader(boolean loadWinkApplication) throws FileNotFoundException {
              super(loadWinkApplication);
              loadClasses(ServletFileLoader.loadFileAsStream(SERVER_CORE_APPLICATION));
          }
      

      to load the META-INF/server/wink-provider file.

      Since these files are ASCII encoded the above decoding does not work.

      I went ahead and encoded both of the files in IBM-1047 encoding which resolved the problem.

      I think Wink should always require UTF-8 for the bundled text files. This way it will work by default when reading the JAR'ed text files, but will require a little more effort for those supporting it on such "exotic" platforms that need to provide their own files (I assume not the majority of the consumers)

      Thanks.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Kaloyan Kolev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development