[ https://issues.apache.org/jira/browse/CXF-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006383#comment-13006383 ]
Glen Mazza commented on CXF-3395: --------------------------------- Benson: Glen, no he does not need to escape anything. StaX will escape as needed, unless something very funny is going on. As I understood the developer's question per his example, he wanted to directly insert Chinese characters within his Java code, and CXF wasn't working under those circumstances. The handful of times I had seen Asian character sets within Java code (or within messages properties files), the characters were escaped as I had shown, and I suggested that that might be a solution for him. To me, StAX/DOM/SAX is only an issue once we are sure the Java runtime has happily accepted the hardcoded Chinese characters in the string constant--it did not appear to me that the user was at that level at the time of posting his question. > cxf transfer hashmap can't be chinese word > ------------------------------------------ > > Key: CXF-3395 > URL: https://issues.apache.org/jira/browse/CXF-3395 > Project: CXF > Issue Type: Bug > Components: JAX-WS Runtime > Affects Versions: 2.3.3 > Environment: spring 3.0+dwr3.0+jdk5+tomcat6 > Reporter: kakashi > Priority: Critical > > hi cxf team: > i use cxf2.3.3 in my project,and i tansfer the hashmap through cxf client > to server(i use the example of apache-cxf-2.3.2,the java_first_jaxws project > in official promulgate package) .firstly it run normally,but when i put some > chinese word(not englist word) to hashmap > i modify the HelloWorldImpl.java(the official example project > file,java_first_jaxws is the project name) function just like this: > HelloWorldImpl.java > public Map<Integer, User> getUsers() { > Map<Integer, User> usersForMap = new LinkedHashMap<Integer, User>(); > //汉字bug 中文 bug > usersForMap.put(1, new UserImpl("yhb汉字bug")); //-->when total english > word,it run ok,when some chinese word here the cxf tell error to me. > usersForMap.put(2, new UserImpl("wybl")); > System.out.println("getUsers called"); > return usersForMap; > } > > it' seem the marshal and unmarshal crash and tell fllow error(englisth > word in hashmap seem runs ok): > org.apache.cxf.interceptor.Fault: Marshalling Error: null > at > org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshalWithBridge(JAXBEncoderDecoder.java:327) > at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:124) > at > org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:251) > at > org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:127) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) > at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:755) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2193) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2037) > at > org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47) > at > org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188) > at > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) > at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:697) > at > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) > at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) > at > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) > at $Proxy61.getMapByCXFDocument(Unknown Source) > at com.webservice.cxf.CxfSoapAction.runWebService(CxfSoapAction.java:77) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:592) > at > org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:740) > at > org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:744) > at > org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:593) > at > org.directwebremoting.dwrp.BaseCallHandler.handle(BaseCallHandler.java:90) > at > org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120) > at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:141) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > at java.lang.Thread.run(Thread.java:595) > Caused by: java.lang.reflect.UndeclaredThrowableException > at $Proxy74.unmarshal(Unknown Source) > at > org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshalWithBridge(JAXBEncoderDecoder.java:312) > ... 49 more > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:592) > at > org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:52) > ... 51 more > Caused by: javax.xml.bind.UnmarshalException > - with linked exception: > [javax.xml.stream.XMLStreamException: Invalid byte 1 of 1-byte UTF-8 > sequence.] > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:426) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362) > at com.sun.xml.bind.v2.runtime.BridgeImpl.unmarshal(BridgeImpl.java:120) > at > com.sun.xml.bind.v2.runtime.BridgeAdapter.unmarshal(BridgeAdapter.java:124) > at com.sun.xml.bind.api.Bridge.unmarshal(Bridge.java:233) > ... 56 more > Caused by: javax.xml.stream.XMLStreamException: Invalid byte 1 of 1-byte > UTF-8 sequence. > at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:560) > at > org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamReader.java:220) > at > com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:192) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360) > ... 59 more > i think this is a terrible bug in transfer hashmap,and i don't know how to > resolve this.can you fix the bug or tell me some solution,my > email:w...@foxmail.com > thank you very much -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira