Ivan Grebenek created CXF-4851:
----------------------------------
Summary: AttachmentDeserializer cannot handle attachments with
Quoted Printable content transfer encoding in initializeRootMessage
Key: CXF-4851
URL: https://issues.apache.org/jira/browse/CXF-4851
Project: CXF
Issue Type: Bug
Affects Versions: 2.7.3, 2.6.6
Reporter: Ivan Grebenek
The issue is the same as CXF-1847, but it happens by initializing root message
in initializeRootMessage() method.
processing SOAP
POST /PortalUpdateStatusServiceWAR/updateStatusService HTTP/1.1
Host: 127.0.0.1:7788
Connection: close, TE
TE: trailers, deflate, gzip, compress
User-Agent: Oracle HTTPClient Version 10h
SOAPAction: updateStatus
Accept-Encoding: gzip, x-gzip, compress, x-compress
Content-type: multipart/related; type="text/xml";
start="<84353ECADD8D15912FBDF2318104ECF4>";
boundary="----=_Part_119_6505558.1361536929956"
Content-length: 138556
------=_Part_119_6505558.1361536929956
Content-Type: text/plain; charset=Cp1251
Content-Transfer-Encoding: quoted-printable
Content-Id: <84353ECADD8D15912FBDF2318104ECF4>
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
...
</env:Body>
</env:Envelope>
------=_Part_119_6505558.1361536929956
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-Id: <3048>
...
results in the following exception:
13:38:30.567 [AJPRequestHandler-RMICallHandler-38] WARN
o.a.cxf.phase.PhaseInterceptorChain - Interceptor for
{http://ws.apache.org/axis2}updateStatusService has thrown exception, unwinding
now
java.lang.RuntimeException: Couldn't parse stream.
at
org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1262)
~[cxf-api-2.6.6.jar:2.6.6]
at
org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:112)
~[cxf-api-2.6.6.jar:2.6.6]
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
~[cxf-api-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
[cxf-api-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:189)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:225)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:145)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
[servlet.jar:na]
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:201)
[cxf-rt-transports-http-2.6.6.jar:2.6.6]
at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734)
[oc4j-internal.jar:na]
at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
[oc4j-internal.jar:na]
at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
[oc4j-internal.jar:na]
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
[oc4j-internal.jar:na]
at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
[oc4j-internal.jar:na]
at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
[oc4j-internal.jar:na]
at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
[oc4j-internal.jar:na]
at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
[oc4j-internal.jar:na]
at java.lang.Thread.run(Thread.java:595) [na:1.5.0_18]
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character
'3' (code 51); expected a quote character enclosing value for 'version'
at [row,col {unknown-source}]: [1,15]
at
com.ctc.wstx.io.InputBootstrapper.reportUnexpectedChar(InputBootstrapper.java:506)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.io.InputBootstrapper.handleEq(InputBootstrapper.java:421)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.io.InputBootstrapper.readXmlVersion(InputBootstrapper.java:319)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.io.InputBootstrapper.readXmlDecl(InputBootstrapper.java:262)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:155)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:610)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:316)
~[woodstox-core-asl-4.1.1.jar:4.1.1]
at
org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1260)
~[cxf-api-2.6.6.jar:2.6.6]
... 20 common frames omitted
I solved that by the following modification (version 2.6.6)
try {
InternetHeaders ih = new InternetHeaders(stream);
message.put(InternetHeaders.class.getName(), ih);
String val = ih.getHeader("Content-Type", "; ");
if (!StringUtils.isEmpty(val)) {
String cs = HttpHeaderHelper.findCharset(val);
if (!StringUtils.isEmpty(cs)) {
message.put(Message.ENCODING,
HttpHeaderHelper.mapCharset(cs));
}
String contentTransferEncoding =
ih.getHeader("Content-Transfer-Encoding", null);
quotedPrintable = contentTransferEncoding != null
&& contentTransferEncoding
.equalsIgnoreCase(QUOTED_PRINTABLE);
}
} catch (MessagingException e) {
throw new RuntimeException(e);
}
InputStream is;
if (quotedPrintable)
{
InputStream rawInputSream = new MimeBodyPartInputStream(stream,
boundary, pbAmount);
is = new
QuotedPrintableDecoderStream(rawInputSream);
}
else
is = new MimeBodyPartInputStream(stream, boundary,
pbAmount);
body = new DelegatingInputStream(is,
this);
createCount++;
message.setContent(InputStream.class, body);
--
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