[ 
https://issues.apache.org/jira/browse/WSCOMMONS-315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rich Scheuerle reopened WSCOMMONS-315:
--------------------------------------


> StAXUtils loads a singleton XML*Factory.  It should load a singleton 
> XML*Factory per classloader
> ------------------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-315
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-315
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>
> Problem Description:
> ------------------------------
> The XMLInputFactory.newInstance() method uses the current classloader to 
> determine which version of STAX XMLInputFactory to load.
> The current StAXUtils.getXMLInputFactory() overrides this behavior and uses 
> the classloader of StAXUtils instead of the current classloader.
> Unfortunately this makes it impossible for Axiom to use the STAX version 
> defined by a different classloader.
> Note: This issue is equally applicable to XMLOutputFactory.  
> Problem Solution:
> -------------------------
> The solution is to change StAXUtils.getXMLInputFactory to return a STAX 
> XMLInputFactory for the current classloader.
> This will comply with the expected STAX behavior.
> A weak map of (key=ClassLoader, value = XMLInputFactory) will be maintained 
> to try and preserve a singleton factory per classloader.
> There will be two ways for users to trigger the old behavior.
> 1) A new method will be added to change the policy:
> /**
>      * Set the policy for how to maintain the XMLInputFactory and 
> XMLOutputFactory
>      * @param value (if false, then one singleton...if true...then singleton 
> per class loader 
>      *  (default is true)
>      */
>     public static void setFactoryPerClassLoader(boolean value) ;
> 2) New methods will be added to programatically request the policy.
>     ie.  getXMLInputFactory(boolean isFactoryPerClassLoaderPolicy);
> Note: The same solution will be applied for XMLOutputFactory.  

-- 
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