Use of String.getBytes() in the code base assumes platform encoding while we 
assume UTF8 in places
--------------------------------------------------------------------------------------------------

                 Key: TUSCANY-3790
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3790
             Project: Tuscany
          Issue Type: Bug
          Components: C++ SCA Kernel
    Affects Versions: Java-SCA-2.0-Beta1
         Environment: All
            Reporter: Simon Laws
             Fix For: Java-SCA-2.0


As per ML thread () there are places in the code base where String.getBytes() 
used without specifying an encoding. However we assume UTF8 in various places, 
e.g. when mapping objects to XML.

A good example is...

public class String2OMElement extends BaseTransformer<String,
OMElement> implements
   PullTransformer<String, OMElement> {

   @SuppressWarnings("unchecked")
   public OMElement transform(String source, TransformationContext context) {
       try {
           StAXOMBuilder builder = new StAXOMBuilder(new
ByteArrayInputStream(source.getBytes()));
           OMElement element = builder.getDocumentElement();
           AxiomHelper.adjustElementName(context, element);
           return element;
       } catch (Exception e) {
           throw new TransformationException(e);
       }
   }

Which Could produce non-UTF8 element content. 

There is also a wider question here about how we handle non-UTF8 content. 
That's a separate discussion though. 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to