aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/xml/providers/XMLInputFactoryProvider.java
blob: 9f3518525dec6caa71ff5602377b126e30a3bd7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.xml.providers;

import com.yahoo.container.di.componentgraph.Provider;

import javax.xml.stream.XMLInputFactory;

/**
 * @author Einar M R Rosenvinge
 * @deprecated Do not use!
 */
@Deprecated
public class XMLInputFactoryProvider implements Provider<XMLInputFactory> {

    private static final String INPUT_FACTORY_INTERFACE = XMLInputFactory.class.getName();
    public static final String FACTORY_CLASS = "com.sun.xml.internal.stream.XMLInputFactoryImpl";

    @Override
    @SuppressWarnings("deprecation")
    public XMLInputFactory get() {
        //ugly, but must be done
        System.setProperty(INPUT_FACTORY_INTERFACE, FACTORY_CLASS);

        // NOTE: In case the newFactory(String, ClassLoader) is used,
        //       the given class loader is ignored if the system property is set!
        return XMLInputFactory.newFactory();
    }

    @Override
    public void deconstruct() { }

}