cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <>
Subject [jira] [Assigned] (CXF-6351) Character encoding error in XML schema validation
Date Fri, 15 May 2015 08:39:59 GMT


Freeman Fang reassigned CXF-6351:

    Assignee: Freeman Fang

> Character encoding error in XML schema validation
> -------------------------------------------------
>                 Key: CXF-6351
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.4, 2.7.15
>         Environment: JVM using platform default encoding other than UTF-8
>            Reporter: Martin Bonato
>            Assignee: Freeman Fang
> I'm using a WSDL with referenced XML schema files containing german umlaut characters.
The WSDL and schema files reside in the applications classpath. When XML schema validation
is enabled for the corresponding webservice, the schema validation fails if the platform default
encoding is not UTF-8 (e.g. ISO-8859-1).
> I've created a test case for the issue (tested with CXF 2.7.15)
> When the test case is executed with a {{-Dfile.encoding=ISO-8859-1}} it fails with:
> {noformat}
> org.apache.cxf.interceptor.Fault: Could not parse the XML stream caused by:
cvc-enumeration-valid: Value 'm�nnlich' is not facet-valid with respect to enumeration '[männlich,
weiblich, unbekannt]'. It must be a value from the enumeration.
> {noformat}
> The reason is, schema references in WSDL files are read using platform default encoding:
> {code:title=org.apache.cxf.wsdl.EndpointReferenceUtils.SchemaLSResourceResolver}
>         private LSInputImpl createInput(String newId, byte[] value) {
>             LSInputImpl impl = new LSInputImpl();
>             impl.setSystemId(newId);
>             impl.setBaseURI(newId);
>             impl.setCharacterStream(
>                 new InputStreamReader(
>                     new ByteArrayInputStream(value)));
>             return impl;
>         }
> {code}
> The {{InputStreamReader}} uses the default platform character encoding. I would recommend
to set the InputStream in LSInputImpl instead of the CharacterStream and let the Schema parser
decide on the character encoding.
> I've created a pull request which solves the problem
(tested with CXF 2.7.x).
> I've only tested with the 2.7.x branch, but from the code I think master is affected
as well.

This message was sent by Atlassian JIRA

View raw message