chengy created CXF-4726:
---------------------------
Summary: AttachmentDataSource stream cache bug and filename
contains non-US-ASCII characters not correct
Key: CXF-4726
URL: https://issues.apache.org/jira/browse/CXF-4726
Project: CXF
Issue Type: Bug
Affects Versions: 2.6.4
Reporter: chengy
Priority: Critical
When test with the mtom example by SAAJ Dispath API,I find 2 bug:
1,the AttachmentPart.getDataHandler().getInputStream() contains no
data,available method get 0;
2,the filename contains non-US-ASCII characters display incorrect.
the client test code like below:
URL wsdlURL=new URL("http://localhost:9000/mime-test?wsdl");
TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME);
TestMtomPortType port = (TestMtomPortType) tms.getPort(PORT_NAME,
TestMtomPortType.class);
Binding binding = ((BindingProvider)port).getBinding();
((SOAPBinding)binding).setMTOMEnabled(true);
DocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
String s="<testDataHandler
xmlns=\"http://cxf.apache.org/mime/types\"><name>Bob</name></testDataHandler>";
Document doc= dbf.newDocumentBuilder().parse(new InputSource(new
StringBufferInputStream(s)));
SOAPMessage msg=MessageFactory.newInstance().createMessage();
msg.getSOAPBody().addDocument(doc);
Dispatch<SOAPMessage> dispatch =tms.createDispatch(PORT_NAME,
SOAPMessage.class, Mode.MESSAGE);
SOAPMessage res= dispatch.invoke(msg);
AttachmentPart attachmentPart=
(AttachmentPart)res.getAttachments().next();
System.out.println(attachmentPart.getDataHandler().getName()+";"+attachmentPart.getDataHandler().getInputStream().available());
the server test code like below:
public void testDataHandler(Holder<String> name, Holder<DataHandler>
attachinfo) {
try {
name.value = "Hello " + name.value;
attachinfo.value = new DataHandler(new FileDataSource(new
File("c:/奋斗1cc.jpg")));
} catch (Exception e) {
e.printStackTrace();
}
}
--
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