Hi Davanum,

Thanks for committing the new Encoder.
However I believe we have one major issue in the way you integrated the
encoder:

XMLUtils getXMLEncoder()

The following code will be called for every String encode, which seems to be
very expensive. As far I know ThreadLocal calls (MessageContext) aren't
really performant on all platforms prior to JDK 1.4, and I think we do have
only two encoding states in the Axis Runtime: Prior to AxisEngine init(),
and after. Prior to init() we should use the default (UTF-8) encoder, after
that the encoder should be static without the decision tree as seen below.
What do you think?


  private static XMLEncoder getXMLEncoder() {
        MessageContext msgContext = MessageContext.getCurrentContext();
        XMLEncoder encoder = null;
        if(msgContext == null) {
            encoder = XMLEncoderFactory.getDefaultEncoder();
        } else {
            String encoding = (String)
msgContext.getAxisEngine().getOption(AxisEngine.PROP_XML_ENCODING);
            try {
                if(encoding != null) {
                    encoder = XMLEncoderFactory.getEncoder(encoding);
                } else {
                    encoder = XMLEncoderFactory.getDefaultEncoder();
                }
            } catch (Exception e) {
                log.error(Messages.getMessage("exception00"), e);
                encoder = XMLEncoderFactory.getDefaultEncoder();
            }
        }
        return encoder;
    }



Reply via email to