[ https://issues.apache.org/jira/browse/WINK-371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496017#comment-13496017 ]
Luciano Resende commented on WINK-371: -------------------------------------- I have made the change as suggested : diff --git a/wink-common/src/main/java/org/apache/wink/common/internal/providers/multipart/MultiPartParser.java b/wink-common/src/main/java/org/apache/wink/common/internal/providers/multipart/MultiPar index 1126a30..bc76772 100644 --- a/wink-common/src/main/java/org/apache/wink/common/internal/providers/multipart/MultiPartParser.java +++ b/wink-common/src/main/java/org/apache/wink/common/internal/providers/multipart/MultiPartParser.java @@ -36,6 +36,7 @@ import org.apache.wink.common.internal.i18n.Messages; public class MultiPartParser { public final static String SEP = "\n"; //$NON-NLS-1$ + public final static String UTF8 = "UTF-8"; //$NON-NLS-1$ private InputStream is; private byte[] boundaryBA; @@ -297,7 +298,7 @@ public class MultiPartParser { return null; } - String hdr = new String(buff, buffIdx, lineIdx); + String hdr = new String(buff, buffIdx, lineIdx, UTF8); buffIdx += lineIdx + breakeSize; return hdr; } And will attach a patched jar. Could you help verify that it fixes the problem. > Data conversion issue for Multi-part MIME on mainframe (z/OS) > ------------------------------------------------------------- > > Key: WINK-371 > URL: https://issues.apache.org/jira/browse/WINK-371 > Project: Wink > Issue Type: Bug > Components: Server > Affects Versions: 1.2 > Environment: z/OS primarily > Reporter: Peter Masters > > We have a method annotated as follows:- > @POST > @Consumes(MediaType.MULTIPART_FORM_DATA) > @Produces(MediaType.TEXT_XML) > When we look through the parts on zOS, using: > while (iterator.hasNext()) { > InPart part = iterator.next(); > InputStream is = part.getBody(InputStream.class, null); > ... > } > we see an exception > java.lang.StringIndexOutOfBoundsException > at java.lang.String.substring(String.java:1092) > at > org.apache.wink.common.internal.providers.multipart.MultiPartParser.parseHeaders(MultiPartParser.java:264) > at > org.apache.wink.common.internal.providers.multipart.MultiPartParser.nextPart(MultiPartParser.java:109) > at > org.apache.wink.common.model.multipart.InMultiPart.hasNext(InMultiPart.java:83) > ... > The headers going over the wire are in UTF-8, but I believe Wink is trying to > decode them as platform encoding (e.g. a new String(bytes), without a > codepage specified). On a regular windows/linux box this would work for > normal codepoints, but on zOS, EBCDIC encoding is nothing like UTF-8, so the > assumption wouldn't work. I'm unfortunately not permitted to look at wink > sourcecode (legal reasons) so I cannot verify this myself, but as this is a > string handling error on a UTF-8 string, that is the best guess I can do. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira