wink-provider files cannot be read when system default encoding is non-ASCII
compliant (e.g. EBCDIC, IBM-1047)
--------------------------------------------------------------------------------------------------------------
Key: WINK-327
URL: https://issues.apache.org/jira/browse/WINK-327
Project: Wink
Issue Type: Bug
Affects Versions: 1.1.2
Environment: IBM Java for z/OS 6.0 running on z/OS 1.12 with default
encoding IBM-1047.
Reporter: Kaloyan Kolev
When executing in the described platform I am getting ClassNotFoundException:
{code}
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>
...
{code}
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:
{code}
final protected void loadClasses(InputStream is) {
try {
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(is));
String line;
l: while ((line = bufferedReader.readLine()) != null) {
...
{code}
Which is being called by:
{code}
public ApplicationFileLoader(String appConfigFile) throws FileNotFoundException
{
logger.debug(Messages.getMessage("loadingApplication", appConfigFile));
//$NON-NLS-1$
loadClasses(FileLoader.loadFileAsStream(appConfigFile));
}
{code}
to load the META-INF/corewink-provider file, and also by:
{code}
public ServletApplicationFileLoader(boolean loadWinkApplication) throws
FileNotFoundException {
super(loadWinkApplication);
loadClasses(ServletFileLoader.loadFileAsStream(SERVER_CORE_APPLICATION));
}
{code}
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.