You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (Jira)" <ji...@apache.org> on 2022/09/05 13:22:00 UTC

[jira] [Updated] (KARAF-7084) Not every factory access from JAXP (specs/java.xml) goes through OsgiLocator

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

Jean-Baptiste Onofré updated KARAF-7084:
----------------------------------------
    Target Version/s: 4.3.8, 4.4.3  (was: 4.3.8, 4.4.2)

> Not every factory access from JAXP (specs/java.xml) goes through OsgiLocator
> ----------------------------------------------------------------------------
>
>                 Key: KARAF-7084
>                 URL: https://issues.apache.org/jira/browse/KARAF-7084
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>            Reporter: Grzegorz Grzybek
>            Assignee: Grzegorz Grzybek
>            Priority: Major
>
> I was checking this code:
> {code:java}
> System.out.println("== JAXP");
> info(DatatypeFactory.class, DatatypeFactory.newInstance());
> info(DocumentBuilderFactory.class, DocumentBuilderFactory.newInstance());
> info(SAXParserFactory.class, SAXParserFactory.newInstance());
> info(XMLEventFactory.class, XMLEventFactory.newInstance());
> info(XMLInputFactory.class, XMLInputFactory.newInstance());
> info(XMLOutputFactory.class, XMLOutputFactory.newInstance());
> info(TransformerFactory.class, TransformerFactory.newInstance());
> info(SchemaFactory.class, SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI));
> info(XPathFactory.class, XPathFactory.newInstance());
> System.out.println("== SAAJ");
> try {
>     info(MessageFactory.class, MessageFactory.newInstance());
>     info(SOAPConnectionFactory.class, SOAPConnectionFactory.newInstance());
>     info(SOAPFactory.class, SOAPFactory.newInstance());
> } catch (Throwable ignored) {
> }
> System.out.println("== JAX-WS");
> try {
>     info(Provider.class, Provider.provider());
> } catch (Throwable ignored) {
> }
> System.out.println("== JAXB");
> try {
>     info(JAXBContext.class, JAXBContext.newInstance("grgr.test.jaxb.model", getClass().getClassLoader()));
>     Class<?> cfClass = FrameworkUtil.getBundle(this.getClass()).adapt(BundleWiring.class).getClassLoader().loadClass("com.sun.xml.bind.v2.ContextFactory");
>     System.out.println("ContextFactory class = " + cfClass);
> } catch (Throwable ignored) {
> }
> ...
> private void info(Class<?> clazz, Object service) {
>     System.out.printf(" - %s: %s%n", clazz, service.getClass().getName());
>     System.out.printf(" - %s%n", FrameworkUtil.getBundle(service.getClass()));
> }
> {code}
> TO see if I really can get implementations of JAXP interfaces, if given interface is implemented in a bundle with proper {{/META-INF/services/<service-name>}}. It works well with _some_ JAXP interfaces and with SAAJ. However it doesn't work with:
> * javax.xml.validation.SchemaFactory
> * javax.xml.xpath.XPathFactory
> * org.xml.sax.helpers.XMLReaderFactory (here there's not even a shaded factory in {{java.xml}} Karaf spec)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)